resolution bug pomme en dehors de la bordure

This commit is contained in:
Wilfried BRIGITTE 2023-12-10 12:09:56 +01:00
parent 63bcdc6bc4
commit 04cb573b9b
3 changed files with 2 additions and 3 deletions

Binary file not shown.

View File

@ -33,13 +33,12 @@ void DessinerScene(){
pomme=ChargerSprite("IMG/pomme.png"); pomme=ChargerSprite("IMG/pomme.png");
for (p = 0; p < 5; p++) { for (p = 0; p < 5; p++) {
pommex[p] = ((rand() % (58)+1)*20); pommex[p] = ((rand() % (58)+1)*20);
pommey[p] = ((rand() % (35)+1)*20); pommey[p] = ((rand() % (34)+1)*20);
AfficherSprite(pomme, pommex[p], pommey[p]); AfficherSprite(pomme, pommex[p], pommey[p]);
} }
} }
/*Apparition aléatoire des pommes*/ /*Apparition aléatoire des pommes*/
void Pomme(){ void Pomme(){
for (pp = 0; pp < 5; ++pp) { for (pp = 0; pp < 5; ++pp) {
AfficherSprite(pomme, pommex[pp], pommey[pp]); AfficherSprite(pomme, pommex[pp], pommey[pp]);
} }

View File

@ -51,7 +51,7 @@ void Serpent(){
if(pommex[p]==pos_x[0] && pommey[p]==pos_y[0]){ if(pommex[p]==pos_x[0] && pommey[p]==pos_y[0]){
segment+=2; segment+=2;
pommex[p] = ((rand() % (58)+1)*20); pommex[p] = ((rand() % (58)+1)*20);
pommey[p] = ((rand() % (35)+1)*20); pommey[p] = ((rand() % (34)+1)*20);
} }
} }