diff --git a/.#Makefile b/.#Makefile deleted file mode 120000 index b86a70b..0000000 --- a/.#Makefile +++ /dev/null @@ -1 +0,0 @@ -khadir@salle222-07.122283:1731070080 \ No newline at end of file diff --git a/comportementJCJ.c b/comportementJCJ.c index 638cfd7..f58cc61 100644 --- a/comportementJCJ.c +++ b/comportementJCJ.c @@ -44,6 +44,12 @@ void compJCJ(int taille){ initialiser++; SourisX = 0; SourisY = 0; + for(tabx = 0; tabx < taille + 2; tabx++){ + for(taby = 0; taby < taille + 2; taby++){ + printf("%d", grille[tabx][taby]); + } + printf("\n"); + } Efface(); EcrireTexte(30, 40, "Joueur 2 choisissez l'emplacement de base du pion 2", 1); } @@ -62,6 +68,13 @@ void compJCJ(int taille){ } SourisX = 0; SourisY = 0; + for(tabx = 0; tabx < taille + 2; tabx++){ + for(taby = 0; taby < taille + 2; taby++){ + printf("%d", grille[tabx][taby]); + } + printf("\n"); + } + } } } @@ -81,17 +94,26 @@ void compJCJ(int taille){ VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso); if(empperso[0] != 0){ if(grille[empperso[1]][empperso[0]] == 0){ - grille[joueurx1][joueury1] = 0; + grille[joueury1][joueurx1] = 0; ChoisirCouleurDessin(CouleurParNom("white")); - RemplirRectangle(joueurx1, joueury1, 45, 45); + RemplirRectangle(emplacementcooX1, emplacementcooY1, 40, 40); ChoisirCouleurDessin(CouleurParNom("black")); joueurx1 = empperso[0]; joueury1 = empperso[1]; empperso[2] = coordonerX(SourisX); empperso[3] = coordonerY(SourisY); - grille[empperso[0]][empperso[1]] = 1; + grille[empperso[1]][empperso[0]] = 1; AfficherSprite(1, empperso[2], empperso[3]); + emplacementcooX1 = empperso[2]; + emplacementcooY1 = empperso[3]; placer = 0; + for(tabx = 0; tabx < taille + 2; tabx++){ + for(taby = 0; taby < taille + 2; taby++){ + printf("%d", grille[tabx][taby]); + } + printf("\n"); + } + } } } @@ -113,9 +135,16 @@ void compJCJ(int taille){ if(grille[empblock[1]][empblock[0]] == 0){ empblock[2] = coordonerX(SourisX); empblock[3] = coordonerY(SourisY); - grille[empblock[0]][empblock[1]] = 3; + grille[empblock[1]][empblock[0]] = 3; AfficherSprite(3, empblock[2], empblock[3]); placer = 0; + for(tabx = 0; tabx < taille + 2; tabx++){ + for(taby = 0; taby < taille + 2; taby++){ + printf("%d", grille[tabx][taby]); + } + printf("\n"); + } + } } } @@ -124,9 +153,44 @@ void compJCJ(int taille){ tour++; }else if(tour == 2){ Efface(); - EcrireTexte(30, 40, "Tour du joueur 2", 2); - /*while(1){}*/ - tour++; + EcrireTexte(30, 40, "Tour du joueur 2", 2); + SourisX = 0; + SourisY = 0; + while(placer == 1){ + if(SourisCliquee()){ + SourisX = _X; + SourisY = _Y; + } + VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso); + if(empperso[0] != 0){ + if(grille[empperso[1]][empperso[0]] == 0){ + grille[joueury2][joueurx2] = 0; + ChoisirCouleurDessin(CouleurParNom("white")); + RemplirRectangle(emplacementcooX2, emplacementcooY2, 40, 40); + ChoisirCouleurDessin(CouleurParNom("black")); + joueurx2 = empperso[0]; + joueury2 = empperso[1]; + empperso[2] = coordonerX(SourisX); + empperso[3] = coordonerY(SourisY); + grille[empperso[1]][empperso[0]] = 2; + AfficherSprite(2, empperso[2], empperso[3]); + emplacementcooX2 = empperso[2]; + emplacementcooY2 = empperso[3]; + placer = 0; + for(tabx = 0; tabx < taille + 2; tabx++){ + for(taby = 0; taby < taille + 2; taby++){ + printf("%d", grille[tabx][taby]); + } + printf("\n"); + } + + } + } + } + empperso[0] = 0; + placer = 1; + tour++; + }else if(tour == 3){ Efface(); EcrireTexte(30, 40, "Joueur 2 place le bloc", 2); @@ -142,9 +206,16 @@ void compJCJ(int taille){ if(grille[empblock[1]][empblock[0]] == 0){ empblock[2] = coordonerX(SourisX); empblock[3] = coordonerY(SourisY); - grille[empblock[0]][empblock[1]] = 4; + grille[empblock[1]][empblock[0]] = 4; AfficherSprite(4, empblock[2], empblock[3]); placer = 0; + for(tabx = 0; tabx < taille + 2; tabx++){ + for(taby = 0; taby < taille + 2; taby++){ + printf("%d", grille[tabx][taby]); + } + printf("\n"); + } + } } } diff --git a/game b/game new file mode 100755 index 0000000..3b6329b Binary files /dev/null and b/game differ