From 4f6efa071c5aae0f07bd042e1f9900ecd2a55b45 Mon Sep 17 00:00:00 2001 From: proal Date: Fri, 2 Dec 2022 20:09:13 +0100 Subject: [PATCH] =?UTF-8?q?r=C3=A9glages=20de=20bugs=20mineurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeu.c | 74 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/jeu.c b/jeu.c index c0faf96..f8a228e 100644 --- a/jeu.c +++ b/jeu.c @@ -11,10 +11,10 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ int pos_x,pos_y; int i,j,g,n=0,x=0, stock_g_1, stock_g_2; int repet2, nb_images; - int clic_x,clic_y,im_y,im_x; + int clic_x,clic_y,im_y,im_x, im_x_1, im_x_2, im_y_1, im_y_2; unsigned long temps, temps2,temps3=1; char tempstab[50],affichage[50],scoretab[50]; - char* comparer1[50], comparer2[50]; + couleur c=CouleurParComposante(0,0,0); temps2=Microsecondes(); ChargerImage("./Images/score.png",760,250,0,0,224,63); @@ -28,6 +28,7 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ ChoisirCouleurDessin(c); EcrireTexte(865,360,scoretab,2); while(score=10;pos_y=pos_y-90){ if (clic_y>=pos_y){ if (clic_y<=pos_y+80){ im_y=pos_y; + if (repet==0){ + im_y_1=pos_y; + } + else{ + im_y_2=pos_y; + } break; } } @@ -122,27 +116,31 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ if (clic_x>=pos_x){ if (clic_x<=pos_x+80){ im_x=pos_x; + if (repet==0){ + im_x_1=pos_x; + } + else{ + im_x_2=pos_x; + } break; } } } - if (im_x!=0 && im_y!=0){ + if (im_x!=0 && im_y!=0 && im_x_1!=im_x_2 && im_y_1!=im_y_2){ for (i=0;i<20;i++){ for (j=0;j<2;j++){ if (position[i][(j*2)]==im_x && position[i][(j*2+1)]==im_y){ + g=i+1; if (repet==0){ - g=i+1; - snprintf(comparer1,50,"Images/image%d.png",g); - ChargerImage(comparer1,im_x,im_y,0,0,80,80); stock_g_1=g; } else{ - g=i+1; - snprintf(comparer2,50,"Images/image%d.png",g); - ChargerImage(comparer2,im_x,im_y,0,0,80,80); stock_g_2=g; } + snprintf(affichage,50,"Images/image%d.png",g); + ChargerImage(affichage,im_x,im_y,0,0,80,80); + printf("%s\n", affichage); repet++; } } @@ -153,7 +151,17 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ /*printf("%d\n", im_x); printf("%d\n", im_y);*/ if (stock_g_1==stock_g_2){ + position[stock_g_1-1][0]=0; + position[stock_g_1-1][1]=0; + position[stock_g_1-1][2]=0; + position[stock_g_1-1][3]=0; score++; + for (i=0;i<40;i++){ + if (tab[i]==stock_g_1){ + printf("oui"); + //nb_trouves[i]=tab[i]; + } + } } repet2=0; if (score!=nb_paires){