diff --git a/SAE_semestre1/img/pomme.png b/SAE_semestre1/img/pomme.png old mode 100755 new mode 100644 index 82bbd05..0514da1 Binary files a/SAE_semestre1/img/pomme.png and b/SAE_semestre1/img/pomme.png differ diff --git a/SAE_semestre1/src/game.c b/SAE_semestre1/src/game.c index d8edbf3..b4a4827 100755 --- a/SAE_semestre1/src/game.c +++ b/SAE_semestre1/src/game.c @@ -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 ; i1160 || 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); } }