diff --git a/SAE_semestre1/fichier.h/fonctions.h b/SAE_semestre1/fichier.h/fonctions.h deleted file mode 100755 index 209efff..0000000 --- a/SAE_semestre1/fichier.h/fonctions.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef FONCTIONS_H -#define FONCTIONS_H - - -#endif \ No newline at end of file diff --git a/SAE_semestre1/img/PAUSE.png b/SAE_semestre1/img/PAUSE.png index 1d69bd1..5f5f77e 100644 Binary files a/SAE_semestre1/img/PAUSE.png and b/SAE_semestre1/img/PAUSE.png differ diff --git a/SAE_semestre1/img/serpent2.png b/SAE_semestre1/img/serpent2.png deleted file mode 100644 index 8269008..0000000 Binary files a/SAE_semestre1/img/serpent2.png and /dev/null differ diff --git a/SAE_semestre1/snake b/SAE_semestre1/snake index 270925c..abcf06d 100755 Binary files a/SAE_semestre1/snake and b/SAE_semestre1/snake differ diff --git a/SAE_semestre1/src/main.c b/SAE_semestre1/src/main.c index 2c9dcd6..da62b8c 100644 --- a/SAE_semestre1/src/main.c +++ b/SAE_semestre1/src/main.c @@ -8,6 +8,7 @@ #include "../fichier.h/time.h" #include "../fichier.h/main.h" #include "../fichier.h/menu.h" +#include "../fichier.h/terrain.h" #define CYCLE 100000L #define DELAI_MILLISECONDES 100 @@ -67,7 +68,16 @@ int lancer_jeu(){ Collision_Serpent(pos_x, pos_y, segment, murx, mury, &go_on); attente(DELAI_MILLISECONDES); Oeuf(pos_x, pos_y, oeufx, oeufy, pointeur_segment); + }else{ + Controle(pointeur_direction, 0, &go_on, pointeur_pause); + Timer( pointeur_minute, pointeur_seconde, pointeur_suivant, pointeur_seconde_actuel, pointeur_old_seconde, timer); + Update_Serpent(pos_x, pos_y, segment, old_x, old_y, pointeur_direction); + dessinerSerpent(pos_x, pos_y, segment, old_x, old_y); + Collision_Serpent(pos_x, pos_y, segment, murx, mury, &go_on); + attente(DELAI_MILLISECONDES); + Oeuf(pos_x, pos_y, oeufx, oeufy, pointeur_segment); } + } } int main(void){ diff --git a/SAE_semestre1/src/serpent.c b/SAE_semestre1/src/serpent.c index 2292bfd..f1d065b 100755 --- a/SAE_semestre1/src/serpent.c +++ b/SAE_semestre1/src/serpent.c @@ -56,22 +56,22 @@ void Collision_Serpent(int pos_x[], int pos_y[], int segment, int murx[], int mu int i; /*Serpent contre coté*/ if (pos_x[0] >1160 || pos_x[0]<=0){ - *go_on=0; + *go_on = 0; } /*Serpent contre coté*/ if (pos_y[0]<20 || pos_y[0] >=720){ - *go_on=0; + *go_on = 0; } /*Serpent contre Serpent*/ for (i = 1; i < segment; i++) { if (pos_x[0] == pos_x[i] && pos_y[0] == pos_y[i]){ - *go_on = 0; + *go_on = 0; } } /*Serpent contre mur*/ for(i=0; i<30;i++){ if(pos_x[0] == murx[i] && pos_y[0] == mury[i]){ - *go_on=0; + *go_on = 0; } } return; @@ -79,6 +79,7 @@ void Collision_Serpent(int pos_x[], int pos_y[], int segment, int murx[], int mu void Controle(int *direction, int last_direction, int *go_on, int *pause) { int t; + int Pause = ChargerSprite("img/PAUSE.png"); while(ToucheEnAttente()) { t = Touche(); switch(t) { @@ -106,13 +107,17 @@ void Controle(int *direction, int last_direction, int *go_on, int *pause) { *direction = 0; *go_on = 0; return; - case XK_space: - if (*pause == 0 ){ - *pause == 1; - }else{ - *pause = 0; - ChargerImage("img/PAUSE.png", 400,200,0,0,350,300); - } + case XK_space : + *pause = 1; + AfficherSprite(Pause, 400, 720); + while(*pause){ + t = Touche(); + if (t == XK_space){ + *pause = 0; + ChoisirCouleurDessin(CouleurParNom("black")); + RemplirRectangle(200,720,800,200); + } + } } } }