From 13d939a37947b002615a65649508be67f1c8607c Mon Sep 17 00:00:00 2001 From: proal Date: Thu, 1 Dec 2022 17:52:53 +0100 Subject: [PATCH] =?UTF-8?q?tout=20va=20bien=20mais=20le=20score=20ne=20s'i?= =?UTF-8?q?ncr=C3=A9mente=20pas=20quand=20il=20faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images.c | 5 +++-- jeu.c | 13 +++++++++---- main.c | 1 - 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/images.c b/images.c index aef7232..9884956 100644 --- a/images.c +++ b/images.c @@ -47,6 +47,7 @@ int tirage_aleatoire(int nb_paires){ for (pos_y=10;pos_y<=370;pos_y=pos_y+90){ for (pos_x=10;pos_x<=640;pos_x=pos_x+90){ if (tab[i]==-1){ + pos_x=650; pos_y=1000; } if (positions[tab[i]][0]==0){ @@ -67,8 +68,8 @@ int tirage_aleatoire(int nb_paires){ } } - /* - for (i=0;i<19;i++){ + + /*for (i=0;i<19;i++){ printf("%03d", i); printf(" "); } diff --git a/jeu.c b/jeu.c index ea3cf78..c0b02e7 100644 --- a/jeu.c +++ b/jeu.c @@ -14,7 +14,7 @@ int jeu(int position[20][4], int nb_paires){ int clic_x,clic_y,im_y,im_x; unsigned long temps, temps2,temps3; char tempstab[50],affichage[50];; - char* comparer[2]; + char* comparer[200]; int tab[3]; couleur c=CouleurParComposante(0,0,0); temps2=Microsecondes(); @@ -71,10 +71,14 @@ int jeu(int position[20][4], int nb_paires){ snprintf(affichage,50,"Images/image%d.png",g); printf("Voici repet: %d\n", repet); printf("Voici affichage: %s\n", affichage); - comparer[repet]=affichage; + if (repet==0){ + comparer[repet]=affichage; + } + printf("Voici comparer[repet]: %s\n", comparer[repet]); printf("Voici comparer[0]: %s\n", comparer[0]); printf("Voici comparer[1]: %s\n\n", comparer[1]); ChargerImage(affichage,im_x,im_y,0,0,80,80); + printf("Voici repet: %d après\n", repet); repet++; } } @@ -86,7 +90,7 @@ int jeu(int position[20][4], int nb_paires){ printf("Voici comparer[1]: %s\n", comparer[1]); /*printf("%d\n", im_x); printf("%d\n", im_y);*/ - if (comparer[0]==comparer[1]){ + if (comparer[0]==affichage){ score++; } repet2=0; @@ -104,6 +108,7 @@ int jeu(int position[20][4], int nb_paires){ } } } - FermerGraphique(); + Touche(); + FermerGraphique(); return EXIT_SUCCESS; } \ No newline at end of file diff --git a/main.c b/main.c index 6f78240..0ad8fe3 100644 --- a/main.c +++ b/main.c @@ -12,6 +12,5 @@ int main(void){ int nb_paires=menu(); char tableautemps[50]; tirage_aleatoire(nb_paires); - FermerGraphique(); return EXIT_SUCCESS; } \ No newline at end of file