résolution pixel vert qui apparait de nulle part

This commit is contained in:
2023-12-12 12:12:22 +01:00
parent 224497863a
commit 1673dc4f5f
2 changed files with 12 additions and 3 deletions

View File

@@ -80,14 +80,13 @@ void DeplacementSerpent(int direction ,int *serpent, int longueur)
int tempX = serpent[0];
int tempY = serpent[1];
int i;
int compteur;
couleur g;
couleur j;
ChoisirEcran(2);
j=CouleurParNom("yellow");
g=CouleurParNom("lightgreen");
ChoisirCouleurDessin(g);
RemplirRectangle(serpent[longueur-2],serpent[longueur-1],T_PIXEL,T_PIXEL);
for (i = 2; i < longueur; i += 2) {
int tempX2 = serpent[i];
@@ -99,6 +98,16 @@ void DeplacementSerpent(int direction ,int *serpent, int longueur)
tempX = tempX2;
tempY = tempY2;
}
for(i=0;i< longueur; i++)
{
if(serpent[i] != NULL)
{
compteur++;
}
}
ChoisirCouleurDessin(g);
RemplirRectangle(serpent[compteur-2],serpent[compteur-1],T_PIXEL,T_PIXEL);
ChoisirCouleurDessin(j);
if(direction == 0) /* Direction vers la gauche */