tout va bien mais le score ne s'incrémente pas quand il faut

This commit is contained in:
Mathieu PROAL 2022-12-01 17:52:53 +01:00
parent 919a0dda6a
commit 13d939a379
3 changed files with 12 additions and 7 deletions

View File

@ -47,6 +47,7 @@ int tirage_aleatoire(int nb_paires){
for (pos_y=10;pos_y<=370;pos_y=pos_y+90){ for (pos_y=10;pos_y<=370;pos_y=pos_y+90){
for (pos_x=10;pos_x<=640;pos_x=pos_x+90){ for (pos_x=10;pos_x<=640;pos_x=pos_x+90){
if (tab[i]==-1){ if (tab[i]==-1){
pos_x=650;
pos_y=1000; pos_y=1000;
} }
if (positions[tab[i]][0]==0){ 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("%03d", i);
printf(" "); printf(" ");
} }

9
jeu.c
View File

@ -14,7 +14,7 @@ int jeu(int position[20][4], int nb_paires){
int clic_x,clic_y,im_y,im_x; int clic_x,clic_y,im_y,im_x;
unsigned long temps, temps2,temps3; unsigned long temps, temps2,temps3;
char tempstab[50],affichage[50];; char tempstab[50],affichage[50];;
char* comparer[2]; char* comparer[200];
int tab[3]; int tab[3];
couleur c=CouleurParComposante(0,0,0); couleur c=CouleurParComposante(0,0,0);
temps2=Microsecondes(); temps2=Microsecondes();
@ -71,10 +71,14 @@ int jeu(int position[20][4], int nb_paires){
snprintf(affichage,50,"Images/image%d.png",g); snprintf(affichage,50,"Images/image%d.png",g);
printf("Voici repet: %d\n", repet); printf("Voici repet: %d\n", repet);
printf("Voici affichage: %s\n", affichage); printf("Voici affichage: %s\n", affichage);
if (repet==0){
comparer[repet]=affichage; comparer[repet]=affichage;
}
printf("Voici comparer[repet]: %s\n", comparer[repet]);
printf("Voici comparer[0]: %s\n", comparer[0]); printf("Voici comparer[0]: %s\n", comparer[0]);
printf("Voici comparer[1]: %s\n\n", comparer[1]); printf("Voici comparer[1]: %s\n\n", comparer[1]);
ChargerImage(affichage,im_x,im_y,0,0,80,80); ChargerImage(affichage,im_x,im_y,0,0,80,80);
printf("Voici repet: %d après\n", repet);
repet++; repet++;
} }
} }
@ -86,7 +90,7 @@ int jeu(int position[20][4], int nb_paires){
printf("Voici comparer[1]: %s\n", comparer[1]); printf("Voici comparer[1]: %s\n", comparer[1]);
/*printf("%d\n", im_x); /*printf("%d\n", im_x);
printf("%d\n", im_y);*/ printf("%d\n", im_y);*/
if (comparer[0]==comparer[1]){ if (comparer[0]==affichage){
score++; score++;
} }
repet2=0; repet2=0;
@ -104,6 +108,7 @@ int jeu(int position[20][4], int nb_paires){
} }
} }
} }
Touche();
FermerGraphique(); FermerGraphique();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

1
main.c
View File

@ -12,6 +12,5 @@ int main(void){
int nb_paires=menu(); int nb_paires=menu();
char tableautemps[50]; char tableautemps[50];
tirage_aleatoire(nb_paires); tirage_aleatoire(nb_paires);
FermerGraphique();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }