From 13ed1961d8d968db6b45d3489ca69f7e36c9d008 Mon Sep 17 00:00:00 2001 From: Amaury Joly Date: Wed, 16 Dec 2020 17:32:21 +0100 Subject: [PATCH] =?UTF-8?q?On=20peut=20changer=20de=20niveau=20quand=20on?= =?UTF-8?q?=20gagne.=20J'ai=20aussi=20ajout=C3=A9=203=20map=20qui=20ne=20s?= =?UTF-8?q?ont=20pas=20test.=20M=C3=AAme=20si=20le=20level=20design=20ca?= =?UTF-8?q?=20me=20les=20brise=20donc=20les=20maps=20sont=20pas=20ouf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Map/map1.gyro | 10 ++++++++++ Map/map2.gyro | 10 ++++++++++ Map/map3.gyro | 10 ++++++++++ src/modele/calculs/Jeu.java | 23 ++++++++++++++++++++++- 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Map/map1.gyro create mode 100644 Map/map2.gyro create mode 100644 Map/map3.gyro diff --git a/Map/map1.gyro b/Map/map1.gyro new file mode 100644 index 0000000..4f1ba98 --- /dev/null +++ b/Map/map1.gyro @@ -0,0 +1,10 @@ +mmmmmmmmmmmmmmmmmmmm +m c c c m +m cmmmmc cmmm +m c c c cm +mcc cm i cmcm +mcc h bcmmmmmmmmmmcm +mcmmmmmc cm +mc cm +mc i cm +mmmmmmmmmmmmmmmmmmmm \ No newline at end of file diff --git a/Map/map2.gyro b/Map/map2.gyro new file mode 100644 index 0000000..eaef9dc --- /dev/null +++ b/Map/map2.gyro @@ -0,0 +1,10 @@ +mmmmmmmmmmmmmmmmmmmm +m c b c m +m cmmmmc mmm +m c c B cm +mcc cm Bmcm +mcc h cmmmmmmmmmmcm +mcmmmmmc cm +mc cm +mc b cm +mmmmmmmmmmmmmmmmmmmm \ No newline at end of file diff --git a/Map/map3.gyro b/Map/map3.gyro new file mode 100644 index 0000000..a09c8eb --- /dev/null +++ b/Map/map3.gyro @@ -0,0 +1,10 @@ +mmmmmmmmmmmmmmmmmmmm +mc hm +mc mmm +mc m ib m cm +mc mmmmmBmB Bmcm +mc B B cm +mc B B cm +mc B cm +mc i cm +mmmmmmmmmmmmmmmmmmmm \ No newline at end of file diff --git a/src/modele/calculs/Jeu.java b/src/modele/calculs/Jeu.java index 22d1caa..086b51b 100644 --- a/src/modele/calculs/Jeu.java +++ b/src/modele/calculs/Jeu.java @@ -67,7 +67,9 @@ public class Jeu { private void resetJeu() { grilleEntites = new ObjetGyromide[SIZE_X][SIZE_Y][2]; map.clear(); + Controle4Directions.getInstance().lstEntitesDynamiques.clear(); hector = null; + nombreDeBombe = 0; } public Heros getHector() { @@ -79,7 +81,8 @@ public class Jeu { this.state = 2; getOrdonnanceur().clear(); resetJeu(); - LecteurFichier.loadMap("Map/test.gyro", this); + mapCourante = 1; + LecteurFichier.loadMap("Map/map1.gyro", this); } public void startTitleScreen() { @@ -89,6 +92,19 @@ public class Jeu { ordonnanceur.add(ControleMenu.getInstance()); } + public void niveauReussi() { + this.state = 2; + getOrdonnanceur().clear(); + resetJeu(); + if(NBR_DE_MAP > mapCourante) { + mapCourante++; + LecteurFichier.loadMap("Map/map" + mapCourante + ".gyro", this); + } else { + startTitleScreen(); + System.out.println("C'est gagné"); + } + } + // PARTIE MANIPULATIONS ENTITE public void addEntite(ObjetGyromide e, int x, int y) { if(e instanceof ElementFond) @@ -247,6 +263,11 @@ public class Jeu { grilleEntites[pCourant.x][pCourant.y][1] = null; map.remove(elt); + + if(elt instanceof Bombe) + if (--nombreDeBombe == 0) + niveauReussi(); + } /** Indique si p est contenu dans la grille