SAE11_2023/SAE_semestre1/Oeuf.c

30 lines
835 B
C
Raw Normal View History

#include <graph.h>
#include <stdlib.h>
#include "Oeuf.h"
#include "time.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);
Score(*segment);
}
}
}