ajout tête serpent + réglage menu fin
This commit is contained in:
parent
150aeaeefd
commit
8cc9818ced
BIN
SAE_semestre1/img/serpent.png
Normal file
BIN
SAE_semestre1/img/serpent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
SAE_semestre1/img/tete_down.png
Normal file
BIN
SAE_semestre1/img/tete_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
SAE_semestre1/img/tete_left.png
Normal file
BIN
SAE_semestre1/img/tete_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
SAE_semestre1/img/tete_right.png
Normal file
BIN
SAE_semestre1/img/tete_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
SAE_semestre1/img/tete_up.png
Normal file
BIN
SAE_semestre1/img/tete_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
@ -64,6 +64,9 @@ int main(void){
|
||||
if(Menu() == 1){
|
||||
lancer_jeu();
|
||||
}
|
||||
if(Menu() == 0){
|
||||
Menu();
|
||||
}
|
||||
FermerGraphique();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -19,8 +19,7 @@ int Menu(void) {
|
||||
case XK_e:
|
||||
choix = 1;
|
||||
return choix;
|
||||
/* Code pour traiter la touche "e" (fermer le jeu, par exemple)*/
|
||||
case XK_a: /* Changement de XK_q à XK_a*/
|
||||
case XK_q: /* Changement de XK_q à XK_a*/
|
||||
/*Code pour traiter la touche "a" (fermer le jeu, par exemple)*/
|
||||
FermerGraphique();
|
||||
exit(EXIT_SUCCESS);
|
||||
@ -30,6 +29,7 @@ int Menu(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Menu_fin(void){
|
||||
int fin = ChargerSprite("../img/Menu_Fin.png");
|
||||
AfficherSprite(fin, 0,0);
|
||||
@ -43,4 +43,5 @@ void bordure(int segment){
|
||||
RemplirRectangle(0,0,1200,20);
|
||||
RemplirRectangle(1180,0,1200,900);
|
||||
Score(segment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,22 +7,21 @@ void Update_Serpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_
|
||||
pos_x[i]=old_x[i-1];
|
||||
pos_y[i]=old_y[i-1];
|
||||
}
|
||||
|
||||
if (*direction == 1){
|
||||
pos_y[0]=old_y[0]-20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
ChargerImage("../img/tete_up.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
if (*direction == 2) {
|
||||
pos_y[0]=old_y[0]+20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
ChargerImage("../img/tete_down.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
if (*direction == 3) {
|
||||
pos_x[0]=old_x[0]-20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
ChargerImage("../img/tete_left.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
if (*direction == 4) {
|
||||
pos_x[0]=old_x[0]+20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
ChargerImage("../img/tete_right.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -30,7 +29,7 @@ void Update_Serpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_
|
||||
void dessinerSerpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_y[]){
|
||||
int i;
|
||||
for (i=0 ; i<segment ; i++){
|
||||
ChargerImage("../img/serpent2.png", old_x[i], old_y[i],0,0, 20,20);
|
||||
ChargerImage("../img/serpent.png", old_x[i], old_y[i],0,0, 20,20);
|
||||
}
|
||||
for (i=0 ; i<segment ; i++){
|
||||
ChoisirCouleurDessin(CouleurParComposante(218,209,77));
|
||||
@ -107,6 +106,7 @@ void Controle(int *direction, int last_direction, int *go_on, int *pause) {
|
||||
void Serpent(int pos_x[], int pos_y[], int old_x[], int old_y[], int *segment, int murx[], int mury[], int *go_on, int *direction) {
|
||||
int serpent;
|
||||
int i = 0;
|
||||
/*Position initial serpent*/
|
||||
pos_x[0] = 600;
|
||||
pos_y[0] = 400;
|
||||
for (i = 0; i < *segment; i++){
|
||||
|
Loading…
Reference in New Issue
Block a user