Fix generation pastilles sur le serpent
This commit is contained in:
11
evenement.c
11
evenement.c
@@ -22,7 +22,7 @@ void AfficherTimerEtScore(int m,int n,int score) /*Afficher le temps passé et
|
||||
CopierZone(1,0,0,0,930,710,0,0);
|
||||
}
|
||||
|
||||
void InitialiserPastilles(PIXELS *pastilles) {
|
||||
void InitialiserPastilles(PIXELS *pastilles, PIXELS *serpent, int longueur_serpent) {
|
||||
int i;
|
||||
couleur r;
|
||||
|
||||
@@ -32,25 +32,24 @@ void InitialiserPastilles(PIXELS *pastilles) {
|
||||
srand(time(NULL));
|
||||
|
||||
for (i = 0; i < PASTILLES; i++) {
|
||||
pastilles[i] = gen_pastille();
|
||||
pastilles[i] = gen_pastille(serpent,longueur_serpent);
|
||||
RemplirRectangle(pastilles[i].x,pastilles[i].y,T_PIXEL,T_PIXEL);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int MangerPastille(PIXELS *serpent, PIXELS* pastilles,unsigned long *score)
|
||||
int MangerPastille(PIXELS *serpent, PIXELS* pastilles,unsigned long *score,int longueur_serpent)
|
||||
{
|
||||
couleur r;
|
||||
int i = 0;
|
||||
|
||||
int j = 0;
|
||||
r = CouleurParNom("red");
|
||||
ChoisirCouleurDessin(r);
|
||||
|
||||
for(i=0;i<PASTILLES;i++)
|
||||
{
|
||||
if(serpent[0].x == pastilles[i].x && serpent[0].y == pastilles[i].y)
|
||||
{
|
||||
pastilles[i] = gen_pastille();
|
||||
pastilles[i] = gen_pastille(serpent,longueur_serpent);
|
||||
RemplirRectangle(pastilles[i].x,pastilles[i].y,T_PIXEL,T_PIXEL);
|
||||
*score+=5;
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user