jeu 100% fonctionnel manque le make file
This commit is contained in:
parent
a04dd8902b
commit
71c6743a35
BIN
SAE_semestre1/img/pomme.png
Executable file → Normal file
BIN
SAE_semestre1/img/pomme.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
@ -13,13 +13,11 @@ void DessinerScene(int murx[], int mury[], int minute, int seconde, char timer [
|
||||
ChoisirCouleurDessin(CouleurParComposante(79,80,35));
|
||||
RemplirRectangle(20,20,1160,700);
|
||||
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
||||
fond = ChargerSprite("../img/fond.png");
|
||||
mur = ChargerSprite("../img/mur.png");
|
||||
srand(time(NULL));
|
||||
for(i=0; i<30; i++){
|
||||
murx[i] = ((rand() % (55)+1)*20);
|
||||
mury[i] = ((rand() % (35)+1)*20);
|
||||
AfficherSprite(mur, murx[i], mury[i]);
|
||||
ChargerImage("../img/mur.png", murx[i], mury[i],0,0, 20,20);
|
||||
}
|
||||
}
|
||||
void Score(int segment){
|
||||
@ -43,8 +41,6 @@ void Update_Timer(int minute, int seconde, char timer[]){
|
||||
}
|
||||
void Update_Serpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_y[], int* direction){
|
||||
int i = 0;
|
||||
int serpent=ChargerSprite("../img/serpent2.png");
|
||||
int fond = ChargerSprite("../img/fond.png");
|
||||
for (i=1 ; i<segment ; i++){
|
||||
pos_x[i]=old_x[i-1];
|
||||
pos_y[i]=old_y[i-1];
|
||||
@ -62,29 +58,29 @@ void Update_Serpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_
|
||||
if (*direction == 4) {
|
||||
pos_x[0]=old_x[0]+20;
|
||||
}
|
||||
for (i=0 ; i<segment ; i++){
|
||||
for (i=0 ; i<segment ; i++){
|
||||
printf("serpent : %d %d\n",pos_x[i],pos_y[i]);
|
||||
RemplirRectangle(pos_x[i], pos_y[i], 20,20);
|
||||
ChargerImage("../img/serpent2.png", pos_x[i], pos_y[i],0,0, 20,20);
|
||||
}
|
||||
for (i=0 ; i<segment ; i++){
|
||||
printf("fond : %d %d\n",old_x[i],old_y[i]);
|
||||
ChoisirCouleurDessin(CouleurParComposante(79,80,35));
|
||||
RemplirRectangle(old_x[i], old_y[i], 20,20);
|
||||
ChoisirCouleurDessin(CouleurParComposante(79,80,35));
|
||||
RemplirRectangle(pos_x[segment-1], pos_y[segment-1], 20,20);
|
||||
|
||||
old_x[i]=pos_x[i];
|
||||
old_y[i]=pos_y[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void Collision_Serpent(int pos_x[], int pos_y[], int segment, int murx[], int mury[], int *go_on){
|
||||
int mur;
|
||||
int i;
|
||||
mur = ChargerSprite("../img/mur.png");
|
||||
/*Serpent contre coté*/
|
||||
if (pos_x[0] >1160 || pos_x[0]<=20){
|
||||
if (pos_x[0] >1160 || pos_x[0]<=0){
|
||||
*go_on=0;
|
||||
}
|
||||
/*Serpent contre coté*/
|
||||
if (pos_y[0]<40 || pos_y[0] >=700){
|
||||
if (pos_y[0]<20 || pos_y[0] >=700){
|
||||
*go_on=0;
|
||||
}
|
||||
/*Serpent contre Serpent*/
|
||||
@ -153,9 +149,9 @@ void Controle(int *direction, int last_direction, int *go_on) {
|
||||
}
|
||||
void Serpent(int pos_x[], int pos_y[], int old_x[], int old_y[], int *segment, int murx[], int mury[], int *go_on, int *direction) {
|
||||
int serpent;
|
||||
int i = 0;
|
||||
pos_x[0] = 600;
|
||||
pos_y[0] = 400;
|
||||
int i = 0;
|
||||
for (i = 0; i < *segment; i++){
|
||||
pos_x[i]= pos_x[0];
|
||||
pos_y[i]= pos_y[0];
|
||||
@ -166,24 +162,22 @@ void Serpent(int pos_x[], int pos_y[], int old_x[], int old_y[], int *segment, i
|
||||
void InitialiserPommes(int pommex[], int pommey[], int segment) {
|
||||
int p;
|
||||
int pomme;
|
||||
pomme = ChargerSprite("../img/pomme.png");
|
||||
for (p = 0; p < 5; p++) {
|
||||
pommex[p] = ((rand() % (55) + 1) * 20);
|
||||
pommey[p] = ((rand() % (35) + 1) * 20);
|
||||
AfficherSprite(pomme, pommex[p], pommey[p]);
|
||||
ChargerImage("../img/pomme.png", pommex[p], pommey[p],0,0, 20,20);
|
||||
}
|
||||
}
|
||||
void Pomme(int pos_x[], int pos_y[], int pommex[], int pommey[], int *segment){
|
||||
int p;
|
||||
int pomme;
|
||||
pomme=ChargerSprite("../img/pomme.png");
|
||||
for (p = 0; p < 5; p++) {
|
||||
AfficherSprite(pomme, pommex[p],pommey[p]);
|
||||
ChargerImage("../img/pomme.png", pommex[p], pommey[p],0,0, 20,20);
|
||||
}
|
||||
for(p=0; p<5; p++){
|
||||
if(pommex[p]==pos_x[0] && pommey[p]==pos_y[0]){
|
||||
(*segment) +=2;
|
||||
pommex[p] = ((rand() % (60)+1)*20);
|
||||
pommex[p] = ((rand() % (53)+1)*20);
|
||||
pommey[p] = ((rand() % (27)+1)*20);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user