avancée sur le retournement 2 par 2

This commit is contained in:
proal 2022-11-29 21:29:46 +01:00
parent 1084712014
commit c24f4a9446

View File

@ -13,6 +13,8 @@ int tirage_aleatoire(void){
int tab[40]; int tab[40];
int nb_paires=20; int nb_paires=20;
int positions[20][4]; int positions[20][4];
int repet;
char comparer[2];
ChargerImage("Images/background.png",0,0,0,0,1024,576); ChargerImage("Images/background.png",0,0,0,0,1024,576);
@ -66,7 +68,13 @@ int tirage_aleatoire(void){
} }
} }
/*for (j=0;j<4;j++){ /*
for (i=0;i<19;i++){
printf("%03d", i);
printf(" ");
}
printf("\n");
for (j=0;j<4;j++){
for (i=0;i<20;i++){ for (i=0;i<20;i++){
printf("%03d", positions[i][j]); printf("%03d", positions[i][j]);
printf(" "); printf(" ");
@ -74,45 +82,54 @@ int tirage_aleatoire(void){
printf("\n"); printf("\n");
}*/ }*/
while(score<=20){ while(score<20){
if (SourisCliquee()){ for (repet=0;repet<3;repet++){
clic_x=_X; if (SourisCliquee()){
clic_y=_Y; clic_x=_X;
clic_y=_Y;
im_x=0; im_x=0;
im_y=0; im_y=0;
for (pos_y=370;pos_y>=10;pos_y=pos_y-90){ for (pos_y=370;pos_y>=10;pos_y=pos_y-90){
if (clic_y>=pos_y){ if (clic_y>=pos_y){
if (clic_y<=pos_y+80){ if (clic_y<=pos_y+80){
im_y=pos_y; im_y=pos_y;
break; break;
}
} }
} }
} for (pos_x=640;pos_x>=10;pos_x=pos_x-90){
for (pos_x=640;pos_x>=10;pos_x=pos_x-90){ if (clic_x>=pos_x){
if (clic_x>=pos_x){ if (clic_x<=pos_x+80){
if (clic_x<=pos_x+80){ im_x=pos_x;
im_x=pos_x; break;
break; }
} }
} }
}
if (im_x!=0 && im_y!=0){
if (im_x!=0 && im_y!=0){ for (i=0;i<20;i++){
for (i=0;i<20;i++){ for (j=0;j<2;j++){
for (j=0;j<2;j++){ if (positions[i][(j*2)]==im_x){
if (positions[i][(j*2)]==im_x){ if (positions[i][(j*2+1)]==im_y){
if (positions[i][(j*2+1)]==im_y){ g=i+1;
g=i+1; snprintf(affichage,50,"Images/image%d.png",g);
snprintf(affichage,50,"Images/image%d.png",g); comparer[repet]=affichage;
ChargerImage(affichage,im_x,im_y,0,0,80,80); ChargerImage(affichage,im_x,im_y,0,0,80,80);
}
} }
} }
} }
} }
} }
} }
if (comparer[0]==comparer[1]){
score++
}
if (score!=20){
}
} }
Touche(); Touche();
FermerGraphique(); FermerGraphique();