ajout des block mais pas fini car plus de temps de semaine donc travaille a la maison requis

This commit is contained in:
2024-11-15 17:22:14 +01:00
parent 50af22bdb0
commit d11b5b8b51
6 changed files with 83 additions and 11 deletions

View File

@@ -7,13 +7,15 @@
#include "initialisation.h"
#include "coordoner.h"
#include "effacehaut.h"
#include "verificationblock.h"
void compJCJ(int taille){
int fin = 0, tabx = 0, taby = 0, tour = 0, initi = 0, SourisX = 0, SourisY = 0, x = 50, y = 100, initialiser = 0;
int maxX = 0, maxY = 0, joueurx1 = 0, joueury1 = 0, joueurx2 = 0, joueury2 = 0;
int maxX = 0, maxY = 0, joueurx1 = 0, joueury1 = 0, joueurx2 = 0, joueury2 = 0, placer = 1;
int emplacementcooX1 = 0, emplacementcooX2 = 0, emplacementcooY1 = 0, emplacementcooY2 = 0;
int grille[taille+2][taille+2];
int empblock[4] = {0, 0, 0, 0};
maxX = DefMaxX(taille);
maxY = DefMaxY(taille);
for(tabx = 0; tabx < taille + 2; tabx++){
@@ -51,7 +53,7 @@ void compJCJ(int taille){
if(SourisX >= 50 && SourisX <= maxX && SourisY >= 100 && SourisY <= maxY){
ChargerSprite("pion2.png");
joueurx2 = initialisationX(SourisX, maxX, taille);
joueury2 = initialisationY(SourisY, maxX, taille);
joueury2 = initialisationY(SourisY, maxY, taille);
if(grille[joueury2][joueurx2] != 1){
emplacementcooX2 = coordonerX(SourisX);
emplacementcooY2 = coordonerY(SourisY);
@@ -70,20 +72,27 @@ void compJCJ(int taille){
Efface();
EcrireTexte(30, 40, "Tour du joueur 1", 2);
tour++;
}else if(tour == 2){
}else if(tour == 1){
Efface();
EcrireTexte(30, 40, "Joueur 1 place le bloc", 2);
while(1){
while(placer == 1){
VerifBlock1(maxX, maxY, taille, empblock);
if(empblock[2] == 6){
printf("%d, %d", empblock[0], empblock[1]);
}
}
placer = 1;
tour++;
}else if(tour == 2){
Efface();
EcrireTexte(30, 40, "Tour du joueur 2", 2);
while(1){}
tour++;
}else if(tour == 3){
Efface();
EcrireTexte(30, 40, "Tour du joueur 2", 2);
tour++;
}else if(tour == 4){
Efface();
EcrireTexte(30, 40, "Joueur 2 place le bloc", 2);
tour++;
while(1){}
tour = 0;
}
}
}