avancemet

This commit is contained in:
Raphael BEAU 2023-12-07 12:34:24 +01:00
parent d5f556dce5
commit 4c9197a2d1

View File

@ -76,23 +76,23 @@ int CliqueTouche(int tab[H][L],int direction){
} }
int DepXTete(unsigned long suivant2,int sxmax,int symax,int direction,int tab[H][L]){ int DepXTete(int* sxmax,int* symax,int direction,int tab[H][L]){
/*haut*/ /*haut*/
if(direction==2){ if(direction==2){
sxmax=sxmax-1; *sxmax=*sxmax-1;
tab[sxmax][symax]=1; tab[*sxmax][*symax]=1;
return sxmax; return *sxmax;
} }
/*bas*/ /*bas*/
if(direction==0){ if(direction==0){
sxmax=sxmax+1; *sxmax=*sxmax+1;
tab[sxmax][symax]=1; tab[*sxmax][*symax]=1;
return sxmax; return *sxmax;
} }
} }
int DepYTete(unsigned long suivant2,int sxmax,int symax,int direction,int tab[H][L]){ int DepYTete(int* sxmax,int* symax,int* direction,int tab[H][L]){
/*droite*/ /*droite*/
if(direction==3){ if(direction==3){
symax=symax+1; symax=symax+1;
@ -117,11 +117,11 @@ void Serpent(int tab[H][L], int* psxmax, int* psxmin, int* psymax, int* psymin,
/*deplacement tete*/ /*deplacement tete*/
if(Microsecondes()>=suivant2){ if(Microsecondes()>=suivant2){
if(pdirection==0||pdirection==2){ if(*pdirection==0||*pdirection==2){
*psxmax=DepXTete(suivant2,psxmax,psymax,pdirection,tab); *psxmax=DepXTete(psxmax,psymax,pdirection,tab);
} }
else if(pdirection==1||pdirection==3){ else if(*pdirection==1||*pdirection==3){
*psymax=DepYTete(suivant2,psxmax,psymax,pdirection,tab); *psymax=DepYTete(psxmax,psymax,pdirection,tab);
} }
suivant2=Microsecondes()+DELTO; suivant2=Microsecondes()+DELTO;
} }