le menu avance

This commit is contained in:
2024-11-18 17:18:12 +01:00
parent 883aff1bec
commit 194076b002
5 changed files with 75 additions and 73 deletions

View File

@@ -1,7 +1,5 @@
#include <graph.h>
#include <stdio.h>
#include "definirMaxXY.h"
#include "initialisation.h"
@@ -11,7 +9,7 @@
int 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 fin = 0, tabx = 0, taby = 0, tour = 0, initi = 0, SourisX = 0, SourisY = 0, initialiser = 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];
@@ -79,8 +77,12 @@ int compJCJ(int taille){
SourisY = _Y;
}
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso);
if(grille[joueury1+1 != 0 && joueury1-1 != 0 && joueurx1+1 != 0 && joueurx1-1 != 0){
printf("\n\nechec\n\n");
if(grille[joueury1+1][joueurx1] != 0 && grille[joueury1-1][joueurx1] != 0 && grille[joueury1+1][joueurx1+1] != 0 && grille[joueury1-1][joueurx1-1] != 0 && grille[joueury1][joueurx1+1] != 0 && grille[joueury1][joueurx1-1] != 0){
LibererSprite(1);
LibererSprite(2);
LibererSprite(3);
LibererSprite(4);
return 2;
}
if(empperso[0] != 0){
if(grille[empperso[1]][empperso[0]] == 0 && (empperso[1] <= joueury1+1 && empperso[1] >= joueury1-1) && (empperso[0] <= joueurx1+1 && empperso[0] >= joueurx1-1)){
@@ -97,13 +99,6 @@ int compJCJ(int taille){
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");
}
}
}
}
@@ -128,13 +123,6 @@ int compJCJ(int taille){
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");
}
}
}
}
@@ -152,6 +140,13 @@ int compJCJ(int taille){
SourisY = _Y;
}
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso);
if(grille[joueury2+1][joueurx2] != 0 && grille[joueury2-1][joueurx2] != 0 && grille[joueury2+1][joueurx2+1] != 0 && grille[joueury2-1][joueurx2-1] != 0 && grille[joueury2][joueurx2+1] != 0 && grille[joueury2][joueurx2-1] != 0){
LibererSprite(1);
LibererSprite(2);
LibererSprite(3);
LibererSprite(4);
return 1;
}
if(empperso[0] != 0){
if(grille[empperso[1]][empperso[0]] == 0 && (empperso[1] <= joueury2+1 && empperso[1] >= joueury2-1) && (empperso[0] <= joueurx2+1 && empperso[0] >= joueurx2-1)){
grille[joueury2][joueurx2] = 0;
@@ -167,13 +162,6 @@ int compJCJ(int taille){
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");
}
}
}
}
@@ -199,13 +187,6 @@ int compJCJ(int taille){
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");
}
}
}
}