From b3dac5655b250cac007768d643e87255492754b2 Mon Sep 17 00:00:00 2001 From: abraham Date: Thu, 14 Nov 2024 14:50:14 +0100 Subject: [PATCH] jeu --- comportementJCJ.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/comportementJCJ.c b/comportementJCJ.c index 2e0265a..785ecdf 100644 --- a/comportementJCJ.c +++ b/comportementJCJ.c @@ -1,8 +1,43 @@ #include +#include + void compJCJ(int taille){ - int fin = 0; + int fin = 0, tabx = 0, taby = 0, tour = 0, initialisation = 0, SourisX = 0, SourisY = 0, x = 50, y = 100; + int grille[taille+2][taille+2]; + for(tabx = 0; tabx < taille + 2; tabx++){ + for(taby = 0; taby < taille + 2; taby++){ + grille[tabx][taby] = 0; + 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(initialisation == 0){ + if(SourisCliquee()){ + SourisX = _X; + SourisY = _Y; + } + printf("%d, %d\n", SourisX, SourisY); + for(y = 100; y >= taille * y; y += 50){ + for(x = 50; x >= taille * x; x += 50){ + if(SourisX >= x && SourisY >= y && SourisX <= x + 50 && SourisY <= y + 50){ + printf("test\n"); + DessinerSegment(0, 0, 500, 500); + } + } + } + } while(fin == 0){ - EcrireTexte(10, 10, "Tour du joueur 1", 1); + if(tour == 0){ + ChoisirCouleurDessin(CouleurParNom("white")); + RemplirRectangle(0, 0, 300, 50); + ChoisirCouleurDessin(CouleurParNom("black")); + EcrireTexte(30, 40, "Tour du joueur 1", 2); + tour++; + } } }