reglage bug serpent qui pouvait se retourner dans le sens opposé
This commit is contained in:
parent
2bbd0a3c01
commit
5376afb589
Binary file not shown.
@ -7,15 +7,15 @@
|
|||||||
#define CYCLE 10000L
|
#define CYCLE 10000L
|
||||||
|
|
||||||
|
|
||||||
int seconde, minute, seconde_actuel, old_seconde;
|
int seconde=0, minute=0, seconde_actuel, old_seconde;
|
||||||
char timer[6];
|
char timer[6];
|
||||||
unsigned long int suivant;
|
unsigned long int suivant;
|
||||||
|
|
||||||
int serpent;
|
int serpent;
|
||||||
int x=500, y=360, direction=4, t, segment=10, i=0;
|
int x=500, y=360, direction=4 /*1 : vers le haut, 2 : vers le bas, 3 vers la gauche, 4 vers la droite*/, t, segment=10, i=0;
|
||||||
int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400];
|
int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400];
|
||||||
|
|
||||||
int p, pp, pomme, pommex[5], pommey[5];
|
int p=0, pp=0, pomme, pommex[5], pommey[5];
|
||||||
int fond, Nbr;
|
int fond, Nbr;
|
||||||
char score[4];
|
char score[4];
|
||||||
|
|
||||||
|
@ -11,20 +11,25 @@ void Controle(){
|
|||||||
t = Touche();
|
t = Touche();
|
||||||
switch(t){
|
switch(t){
|
||||||
case XK_Left :
|
case XK_Left :
|
||||||
direction=3;
|
if (direction != 4){
|
||||||
break;
|
direction=3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case XK_Right:
|
case XK_Right:
|
||||||
direction=4;
|
if (direction != 3){
|
||||||
break;
|
direction=4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case XK_Up:
|
case XK_Up:
|
||||||
direction=1;
|
if(direction !=2){
|
||||||
break;
|
direction=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case XK_Down:
|
case XK_Down:
|
||||||
direction=2;
|
if (direction !=1){
|
||||||
break;
|
direction=2;
|
||||||
case XK_Escape:
|
break;
|
||||||
go_on=0;
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user