Rectifications DAVID
This commit is contained in:
38
evenement.c
38
evenement.c
@@ -38,7 +38,7 @@ void InitialiserPastilles(PIXELS *pastilles) {
|
||||
}
|
||||
}
|
||||
|
||||
int MangerPastille(int *serpent, PIXELS* pastilles,unsigned long *score)
|
||||
int MangerPastille(PIXELS *serpent, PIXELS* pastilles,unsigned long *score)
|
||||
{
|
||||
couleur r;
|
||||
int i = 0;
|
||||
@@ -48,7 +48,7 @@ int MangerPastille(int *serpent, PIXELS* pastilles,unsigned long *score)
|
||||
|
||||
for(i=0;i<PASTILLES;i++)
|
||||
{
|
||||
if(serpent[0] == pastilles[i].x && serpent[1] == pastilles[i].y)
|
||||
if(serpent[0].x == pastilles[i].x && serpent[0].y == pastilles[i].y)
|
||||
{
|
||||
pastilles[i] = gen_pastille();
|
||||
RemplirRectangle(pastilles[i].x,pastilles[i].y,T_PIXEL,T_PIXEL);
|
||||
@@ -75,10 +75,10 @@ int MangerPastille(int *serpent, PIXELS* pastilles,unsigned long *score)
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
void DeplacementSerpent(int direction ,int *serpent, int longueur)
|
||||
void DeplacementSerpent(int direction ,PIXELS *serpent, int longueur)
|
||||
{
|
||||
int tempX = serpent[0];
|
||||
int tempY = serpent[1];
|
||||
int tempX = serpent[0].x;
|
||||
int tempY = serpent[0].y;
|
||||
int i;
|
||||
int compteur;
|
||||
couleur g;
|
||||
@@ -89,46 +89,46 @@ void DeplacementSerpent(int direction ,int *serpent, int longueur)
|
||||
|
||||
|
||||
for (i = 2; i < longueur; i += 2) {
|
||||
int tempX2 = serpent[i];
|
||||
int tempY2 = serpent[i + 1];
|
||||
int tempX2 = serpent[i].x;
|
||||
int tempY2 = serpent[i].y;
|
||||
|
||||
serpent[i] = tempX;
|
||||
serpent[i + 1] = tempY;
|
||||
serpent[i].x = tempX;
|
||||
serpent[i].y = tempY;
|
||||
|
||||
tempX = tempX2;
|
||||
tempY = tempY2;
|
||||
}
|
||||
for(i=0;i< longueur; i++)
|
||||
{
|
||||
if(serpent[i] != NULL)
|
||||
if(serpent[i].x != NULL && serpent[i].y != NULL)
|
||||
{
|
||||
compteur++;
|
||||
}
|
||||
}
|
||||
ChoisirCouleurDessin(g);
|
||||
RemplirRectangle(serpent[compteur-2],serpent[compteur-1],T_PIXEL,T_PIXEL);
|
||||
RemplirRectangle(serpent[compteur].x,serpent[compteur].y,T_PIXEL,T_PIXEL);
|
||||
|
||||
|
||||
ChoisirCouleurDessin(j);
|
||||
if(direction == 0) /* Direction vers la gauche */
|
||||
{
|
||||
serpent[0]-=T_PIXEL;
|
||||
RemplirRectangle(serpent[0],serpent[1],T_PIXEL,T_PIXEL);
|
||||
serpent[0].x-=T_PIXEL;
|
||||
RemplirRectangle(serpent[0].x,serpent[0].y,T_PIXEL,T_PIXEL);
|
||||
}
|
||||
else if(direction == 1) /* Direction vers le haut */
|
||||
{
|
||||
serpent[1]-=T_PIXEL;
|
||||
RemplirRectangle(serpent[0],serpent[1],T_PIXEL,T_PIXEL);
|
||||
serpent[0].y-=T_PIXEL;
|
||||
RemplirRectangle(serpent[0].x,serpent[0].y,T_PIXEL,T_PIXEL);
|
||||
|
||||
}
|
||||
else if(direction == 2) /* Direction vers la droite */
|
||||
{
|
||||
serpent[0]+=T_PIXEL;
|
||||
RemplirRectangle(serpent[0],serpent[1],T_PIXEL,T_PIXEL);
|
||||
serpent[0].x+=T_PIXEL;
|
||||
RemplirRectangle(serpent[0].x,serpent[0].y,T_PIXEL,T_PIXEL);
|
||||
}
|
||||
else if(direction == 3) /* Direction vers le bas */
|
||||
{
|
||||
serpent[1]+=T_PIXEL;
|
||||
RemplirRectangle(serpent[0],serpent[1],T_PIXEL,T_PIXEL);
|
||||
serpent[0].y+=T_PIXEL;
|
||||
RemplirRectangle(serpent[0].x,serpent[0].y,T_PIXEL,T_PIXEL);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user