From 919a0dda6a6540d5903229cc5cc0c7b1a76c10b9 Mon Sep 17 00:00:00 2001 From: proal Date: Thu, 1 Dec 2022 16:42:34 +0100 Subject: [PATCH] =?UTF-8?q?liaison=20du=20nombres=20de=20paires,=20r=C3=A9?= =?UTF-8?q?glages=20du=20reretournage=20des=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images.c | 5 ++--- images.h | 2 +- jeu.c | 19 +++++++++++++------ jeu.h | 2 +- main.c | 2 +- menu.c | 6 +++--- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/images.c b/images.c index 4c300a9..aef7232 100644 --- a/images.c +++ b/images.c @@ -6,14 +6,13 @@ #include #include "jeu.h" -int tirage_aleatoire(void){ +int tirage_aleatoire(int nb_paires){ InitialiserGraphique(); char tirage[50]; int pos_x, pos_y, clic_x, clic_y, im_y, im_x; int i, j; int nb,score; int tab[40]; - int nb_paires=10; int positions[20][4]; ChargerImage("Images/background.png",0,0,0,0,1024,576); @@ -81,7 +80,7 @@ int tirage_aleatoire(void){ } printf("\n"); }*/ - score=jeu(positions); + score=jeu(positions, nb_paires); Touche(); FermerGraphique(); printf("\n"); diff --git a/images.h b/images.h index 5a598cc..3032b20 100644 --- a/images.h +++ b/images.h @@ -1,6 +1,6 @@ #ifndef IMAGES_H #define IMAGES_H -int tirage_aleatoire(void); +int tirage_aleatoire(int nb_paires); #endif \ No newline at end of file diff --git a/jeu.c b/jeu.c index bf7623e..ea3cf78 100644 --- a/jeu.c +++ b/jeu.c @@ -6,11 +6,11 @@ #include "jeu.h" #include -int jeu(int position[20][4]){ +int jeu(int position[20][4], int nb_paires){ int score=0,repet,test=0; int pos_x,pos_y; int i,j,g; - int nb_paires; + int repet2, nb_images; int clic_x,clic_y,im_y,im_x; unsigned long temps, temps2,temps3; char tempstab[50],affichage[50];; @@ -18,7 +18,11 @@ int jeu(int position[20][4]){ int tab[3]; couleur c=CouleurParComposante(0,0,0); temps2=Microsecondes(); - while(score<20){ + + printf("Voici le nombre de paires: %d\n", nb_paires); + nb_images=nb_paires*2; + score=0; + while(score=291 && xpos<=320) && (ypos>=256 && ypos<=287)){ i--; - if (i==3){ + if (i==0){ i=20; } } if((xpos>=714 && xpos<=739) && (ypos>=256 && ypos<=287)){ i++; if(i==21){ - i=4; + i=1; } } if((xpos>=380 && xpos<=650) && (ypos>=402 && ypos<=473)){