La fonction qui ajoute les bloque et qui ne le fait pas si la case est déjà prise est faite youuuuuuuuhouuuuuuu
This commit is contained in:
@@ -24,9 +24,7 @@ void compJCJ(int taille){
|
||||
if(taby == 0 || taby == taille + 1 || tabx == 0 || tabx == taille + 1){
|
||||
grille[tabx][taby] = 9;
|
||||
}
|
||||
printf("%d", grille[tabx][taby]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
EcrireTexte(30, 40, "Joueur 1 choisissez l'emplacement de base du pion 1", 1);
|
||||
while(initi == 0){
|
||||
@@ -71,14 +69,36 @@ void compJCJ(int taille){
|
||||
if(tour == 0){
|
||||
Efface();
|
||||
EcrireTexte(30, 40, "Tour du joueur 1", 2);
|
||||
SourisX = 0;
|
||||
SourisY = 0;/*
|
||||
while(placer == 1){
|
||||
if(SourisCliquee()){
|
||||
SourisX = _X;
|
||||
SourisY = _Y;
|
||||
}
|
||||
}*/
|
||||
placer = 1;
|
||||
tour++;
|
||||
}else if(tour == 1){
|
||||
Efface();
|
||||
EcrireTexte(30, 40, "Joueur 1 place le bloc", 2);
|
||||
SourisX = 0;
|
||||
SourisY = 0;
|
||||
while(placer == 1){
|
||||
VerifBlock1(maxX, maxY, taille, empblock);
|
||||
if(empblock[2] == 6){
|
||||
printf("%d, %d", empblock[0], empblock[1]);
|
||||
if(SourisCliquee()){
|
||||
SourisX = _X;
|
||||
SourisY = _Y;
|
||||
}
|
||||
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empblock);
|
||||
if(empblock[0] != 0){
|
||||
ChargerSprite("croix1.png");
|
||||
grille[empblock[0]][empblock[1]];
|
||||
if(grille[empblock[1]][empblock[0]] == 0){
|
||||
empblock[2] = coordonerX(SourisX);
|
||||
empblock[3] = coordonerY(SourisY);
|
||||
AfficherSprite(3, empblock[2], empblock[3]);
|
||||
placer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
placer = 1;
|
||||
@@ -86,12 +106,31 @@ void compJCJ(int taille){
|
||||
}else if(tour == 2){
|
||||
Efface();
|
||||
EcrireTexte(30, 40, "Tour du joueur 2", 2);
|
||||
while(1){}
|
||||
/*while(1){}*/
|
||||
tour++;
|
||||
}else if(tour == 3){
|
||||
Efface();
|
||||
EcrireTexte(30, 40, "Joueur 2 place le bloc", 2);
|
||||
while(1){}
|
||||
SourisX = 0;
|
||||
SourisY = 0;
|
||||
while(placer == 1){
|
||||
if(SourisCliquee()){
|
||||
SourisX = _X;
|
||||
SourisY = _Y;
|
||||
}
|
||||
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empblock);
|
||||
if(empblock[0] != 0){
|
||||
ChargerSprite("croix2.png");
|
||||
grille[empblock[0]][empblock[1]];
|
||||
if(grille[empblock[1]][empblock[0]] == 0){
|
||||
empblock[2] = coordonerX(SourisX);
|
||||
empblock[3] = coordonerY(SourisY);
|
||||
AfficherSprite(4, empblock[2], empblock[3]);
|
||||
placer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
placer = 1;
|
||||
tour = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,12 @@
|
||||
#include "initialisation.h"
|
||||
|
||||
|
||||
int VerifBlock1(int maxX, int maxY, int taille, int* coordoner){
|
||||
int SourisX = 0, SourisY = 0, placement = 1, placementX = 0, placementY = 0;
|
||||
if(SourisCliquee()){
|
||||
SourisX = _X;
|
||||
SourisY = _Y;
|
||||
}
|
||||
int VerifBlock1(int SourisX, int SourisY, int maxX, int maxY, int taille, int* coordoner){
|
||||
int placement = 1, placementX = 0, placementY = 0;
|
||||
if(SourisX >= 50 && SourisX <= maxX && SourisY >= 100 && SourisY <= maxY){
|
||||
placementX = initialisationXbox(SourisX, maxX, taille);
|
||||
placementY = initialisationYbox(SourisY, maxY, taille);
|
||||
}
|
||||
coordoner[0] = placementX;
|
||||
coordoner[1] = placementY;
|
||||
coordoner[2] = 6;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef VERIFICATIONBLOCK_H
|
||||
#define VERIFICATIONBLOCK_H
|
||||
|
||||
int VerifBlock1(int maxX, int maxY, int taille, int* coordoner);
|
||||
int VerifBlock1(int SourisX, int SourisY, int maxX, int maxY, int taille, int* coordoner);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user