enlevment des extern 2

This commit is contained in:
Wilfried BRIGITTE 2023-12-18 17:05:44 +01:00
parent 8f5e06d9c6
commit 36a53c30c2
5 changed files with 13 additions and 12 deletions

Binary file not shown.

View File

@ -9,7 +9,7 @@ extern char timer[6];
extern unsigned long int suivant; extern unsigned long int suivant;
extern int serpent, tete_up, tete_down, tete_right, tete_left; extern int serpent, tete_up, tete_down, tete_right, tete_left;
extern int x, y, direction,segment; extern int direction,segment;
extern int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400]; extern int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400];
extern long int vitesse; extern long int vitesse;

View File

@ -11,9 +11,9 @@ unsigned long int suivant;
long int vitesse=100000; long int vitesse=100000;
int serpent; int serpent;
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 direction=4 /*1 : vers le haut, 2 : vers le bas, 3 vers la gauche, 4 vers la droite*/, 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 tete_up, tete_down, tete_right, tete_left, queue_up, queue_down, queue_left, queue_right; int tete_up, tete_down, tete_right, tete_left;
int pomme, pommex[5], pommey[5]; int pomme, pommex[5], pommey[5];
int fond, Nbr; int fond, Nbr;
@ -24,6 +24,7 @@ int go_menu=1;
int pause=1; int pause=1;
int imageMenu; int imageMenu;
int go_menu2=1; int go_menu2=1;
int t;
int t2; int t2;
int t3; int t3;
@ -60,7 +61,6 @@ int main(){
while(go_on){ while(go_on){
Controle(); Controle();
if (pause==1){ if (pause==1){
printf("test\n");
Timer(); Timer();
Score(); Score();
Collision(); Collision();

View File

@ -27,9 +27,9 @@ void DessinerScene(){
tete_right = ChargerSprite("IMG/tete_right.png"); tete_right = ChargerSprite("IMG/tete_right.png");
for (i = 0; i < segment; i++){ for (i = 0; i < segment; i++){
AfficherSprite(serpent, x-(i*20), y); AfficherSprite(serpent, 500-(i*20), 360);
pos_x[i]=x-(i*20); pos_x[i]=500-(i*20);
pos_y[i]=y; pos_y[i]=360;
old_y[i]=pos_y[i]; old_y[i]=pos_y[i];
old_x[i]=pos_x[i]; old_x[i]=pos_x[i];
} }

View File

@ -12,27 +12,27 @@ void Controle(){
case XK_Left : case XK_Left :
if (direction != 4){ if (direction != 4){
direction=3; direction=3;
break;
} }
break;
case XK_Right: case XK_Right:
if (direction != 3){ if (direction != 3){
direction=4; direction=4;
break;
} }
break;
case XK_Up: case XK_Up:
if(direction !=2){ if(direction !=2){
direction=1; direction=1;
break;
} }
break;
case XK_Down: case XK_Down:
if (direction !=1){ if (direction !=1){
direction=2; direction=2;
break;
} }
break;
case XK_Escape: case XK_Escape:
go_on=0; go_on=0;
go_menu=0; go_menu=0;
break;
case XK_space: case XK_space:
if (pause==0){ if (pause==0){
pause=1; pause=1;
@ -41,6 +41,7 @@ void Controle(){
ChoisirCouleurDessin(CouleurParComposante(255,255,255)); ChoisirCouleurDessin(CouleurParComposante(255,255,255));
EcrireTexte(500,750,"Jeu en Pause",2); EcrireTexte(500,750,"Jeu en Pause",2);
} }
break;
} }
} }
} }