ajout des commentaires

This commit is contained in:
Jude Christ AISSI 2023-12-24 12:19:00 +01:00
parent 15da776376
commit 5974fb7059
8 changed files with 6 additions and 4 deletions

View File

@ -23,9 +23,8 @@ run : $(EXE)
clean : clean :
-rm -rf $(ODIR) -rm -rf $(ODIR)
# Nouvelle règle pour la dépendance implicite
$(EXE): $(ODIR)/a.out $(EXE): $(ODIR)/a.out
# Nouvelle règle pour construire 'out/a.out' # construction 'out/a.out'
$(ODIR)/a.out: $(OFILES) $(ODIR)/a.out: $(OFILES)
$(CC) $(CFLAGS) -o $@ $(OFILES) $(CC) $(CFLAGS) -o $@ $(OFILES)

View File

@ -1,7 +1,6 @@
#ifndef MAIN_H #ifndef MAIN_H
#define MAIN_H #define MAIN_H
void attente(int milliseconds); void attente(int milliseconds);
int lancer_jeu(void); int lancer_jeu(void);
int main(void); int main(void);

Binary file not shown.

View File

@ -8,6 +8,7 @@
void InitialiserOeufs(int oeufx[], int oeufy[], int segment) { void InitialiserOeufs(int oeufx[], int oeufy[], int segment) {
int p; int p;
int oeuf; int oeuf;
/*Boucles qui initialse 5 pommes aléatoirement*/
for (p = 0; p < 5; p++) { for (p = 0; p < 5; p++) {
oeufx[p] = ((rand() % (55) + 1) * 20); oeufx[p] = ((rand() % (55) + 1) * 20);
oeufy[p] = ((rand() % (35) + 1) * 20); oeufy[p] = ((rand() % (35) + 1) * 20);
@ -20,6 +21,7 @@ void Oeuf(int old_x[], int old_y[], int oeufx[], int oeufy[], int *segment){
for (p = 0; p < 5; p++) { for (p = 0; p < 5; p++) {
ChargerImage("img/oeuf.png", oeufx[p], oeufy[p],0,0, 20,20); ChargerImage("img/oeuf.png", oeufx[p], oeufy[p],0,0, 20,20);
} }
/*Boucles pour vérifiier la colision avec le serpent */
for(p=0; p<5; p++){ for(p=0; p<5; p++){
if(oeufx[p]==old_x[0] && oeufy[p]==old_y[0]){ if(oeufx[p]==old_x[0] && oeufy[p]==old_y[0]){
(*segment) +=2; (*segment) +=2;

View File

@ -76,7 +76,7 @@ int lancer_jeu(){
Collision_Serpent(pos_x, pos_y, segment, murx, mury, &go_on); Collision_Serpent(pos_x, pos_y, segment, murx, mury, &go_on);
attente(DELAI_MILLISECONDES); attente(DELAI_MILLISECONDES);
Oeuf(pos_x, pos_y, oeufx, oeufy, pointeur_segment); Oeuf(pos_x, pos_y, oeufx, oeufy, pointeur_segment);
} }
} }
} }

View File

@ -14,6 +14,7 @@ void Menu_fin(void){
int fin = ChargerSprite("img/Menu_Fin.jpg"); int fin = ChargerSprite("img/Menu_Fin.jpg");
AfficherSprite(fin, 0,0); AfficherSprite(fin, 0,0);
} }
int Menu(void) { int Menu(void) {
int choix = 1; int choix = 1;
InitialiserGraphique(); InitialiserGraphique();

View File

@ -19,6 +19,7 @@ void Scene(int murx[], int mury[], int minute, int seconde, char timer []){
RemplirRectangle(20,20,1160,700); RemplirRectangle(20,20,1160,700);
ChoisirCouleurDessin(CouleurParComposante(255,255,255)); ChoisirCouleurDessin(CouleurParComposante(255,255,255));
srand(time(NULL)); srand(time(NULL));
/*Initialisation de 30 obstacles */
for(i=0; i<30; i++){ for(i=0; i<30; i++){
murx[i] = ((rand() % (55)+1)*20); murx[i] = ((rand() % (55)+1)*20);
mury[i] = ((rand() % (35)+1)*20); mury[i] = ((rand() % (35)+1)*20);

0
bashrc
View File