SAE11_2023/SAE_semestre1/src/Oeuf.c

27 lines
792 B
C
Executable File

#include <graph.h>
#include <stdlib.h>
#include "../fichier.h/Oeuf.h"
void InitialiserOeufs(int oeufx[], int oeufy[], int segment) {
int p;
int oeuf;
for (p = 0; p < 5; p++) {
oeufx[p] = ((rand() % (55) + 1) * 20);
oeufy[p] = ((rand() % (35) + 1) * 20);
ChargerImage("../img/oeuf.png", oeufx[p], oeufy[p],0,0, 20,20);
}
}
void Oeuf(int pos_x[], int pos_y[], int oeufx[], int oeufy[], int *segment){
int p;
int oeuf;
for (p = 0; p < 5; p++) {
ChargerImage("../img/oeuf.png", oeufx[p], oeufy[p],0,0, 20,20);
}
for(p=0; p<5; p++){
if(oeufx[p]==pos_x[0] && oeufy[p]==pos_y[0]){
(*segment) +=2;
oeufx[p] = ((rand() % (55)+1)*20);
oeufy[p] = ((rand() % (35)+1)*20);
}
}
}