From 50f209ef031b9768e4dd069fe49fcb26ca2400d7 Mon Sep 17 00:00:00 2001 From: ZIRTR0X <76250995+ZIRTR0X@users.noreply.github.com> Date: Thu, 20 Jan 2022 14:40:50 +0100 Subject: [PATCH] Ajout des chemins pour les mobs map medium et hard --- code/src/controller/CreatureController.java | 4 ++- .../src/controller/MapCreatureController.java | 33 ++++++++++++++++--- code/src/model/GameLoop.java | 2 +- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/code/src/controller/CreatureController.java b/code/src/controller/CreatureController.java index 497a850..d9d63aa 100644 --- a/code/src/controller/CreatureController.java +++ b/code/src/controller/CreatureController.java @@ -93,10 +93,12 @@ public class CreatureController { e.printStackTrace(); } if(i>=mapCreatureController.getSizeListeCase()-2) { - System.out.println("FIN"); creatureImageView.setImage(new Image("/image/creature/void.png")); + System.out.println("FIN 1"); } } + System.out.println("FIN 2"); + creatureImageView.setImage(new Image("/image/creature/void.png")); } }; Creature.start(); diff --git a/code/src/controller/MapCreatureController.java b/code/src/controller/MapCreatureController.java index c735ecd..1e3ceb6 100644 --- a/code/src/controller/MapCreatureController.java +++ b/code/src/controller/MapCreatureController.java @@ -16,6 +16,10 @@ public class MapCreatureController { public void creerMapCreature() { int[][] coord1Lv1 = {{0,-1},{0,0},{1,0},{2,0},{3,0},{3,1},{4,1},{5,1},{6,1},{7,1},{8,1},{9,1},{9,2},{10,2},{11,2},{12,2},{13,2},{14,2},{15,2},{16,2},{17,2},{18,2},{19,2},{20,2},{21,2},{21,3},{21,4},{22,4},{23,4},{24,4},{25,4},{25,5},{25,6},{26,6},{27,6},{28,6},{28,7},{28,8},{28,9},{28,10},{28,11},{28,12},{29,12},{30,12}}; int[][] coord2Lv1 = {{30,27},{29,27},{28,27},{27,27},{26,27},{25,27},{24,27},{23,27},{23,26},{22,26},{21,26},{20,26},{20,25},{19,25},{18,25},{17,25},{16,25},{15,25},{14,25},{13,25},{13,24},{12,24},{11,24},{10,24},{9,24},{8,24},{7,24},{6,24},{6,25},{6,26},{5,26},{4,26},{3,26},{2,26},{1,26},{-1,26},{-2,26}}; + int[][] coord1Lv2 = {{0,-1},{0,0},{0,1},{0,2},{1,2},{2,2},{3,2},{3,3},{3,4},{3,5},{4,5},{5,5},{6,5},{7,5},{8,5},{8,6},{9,6},{9,7},{9,8},{10,8},{11,8},{12,8},{12,9},{13,9},{14,9},{15,9},{16,9},{17,9},{18,9},{18,10},{19,10},{20,10},{20,9},{21,9},{21,8},{21,7},{20,7},{20,6},{19,6},{18,6},{18,7},{17,7},{16,7},{15,7},{14,7},{14,6},{14,5},{14,4},{15,4},{15,3},{15,2},{14,2},{14,1},{14,0},{14,-1},{14,-2}}; + int[][] coord2Lv2 = {{30,22},{29,22},{28,22},{27,22},{26,22},{25,22},{24,22},{24,21},{23,21},{22,21},{22,20},{21,20},{20,20},{19,20},{18,20},{17,20},{17,19},{16,19},{15,19},{14,19},{14,18},{13,18},{13,17},{13,16},{14,16},{15,16},{16,16},{17,16},{17,17},{18,17},{19,17},{20,17},{21,17},{21,16},{21,15},{22,15},{23,15},{24,15},{25,15},{26,15},{26,14},{27,14},{28,14},{28,13},{28,12},{29,12},{30,12}}; + int[][] coord1Lv3 = {{30,4},{29,4},{28,4},{27,4},{26,4},{25,4},{24,4},{23,4},{23,5},{23,6},{23,7},{22,7},{21,7},{20,7},{20,6},{19,6},{19,5},{19,4},{18,4},{17,4},{17,5},{17,6},{17,7},{18,7},{18,8},{19,8},{20,8},{21,8},{22,8},{23,8},{24,8},{24,9},{25,9},{26,9},{27,9},{28,9},{29,9},{30,9}}; + int[][] coord2Lv3 = {{-1,7},{0,7},{1,7},{2,7},{2,8},{3,8},{4,8},{4,9},{5,9},{6,9},{7,9},{8,9},{9,9},{9,10},{10,10},{11,10},{12,10},{13,10},{14,10},{14,11},{14,12},{15,12},{15,13},{14,13},{13,13},{12,13},{11,13},{11,12},{11,11},{11,10},{10,10},{9,10},{8,10},{8,11},{7,11},{7,12},{7,13},{6,13},{5,13},{4,13},{4,12},{4,11},{4,10},{3,10},{2,10},{1,10},{0,10},{-1,10}}; //int[][] coordLv1 = {{1,0},{2,0},{3,0},{4,0},{5,0},{6,0},{7,0},{8,0},{9,0}}; //int[][] coordLv1 = {{0,24},{1,24},{2,24},{3,24},{4,24},{5,24},{5,23},{5,22},{5,21},{5,20},{5,19},{5,18},{6,18},{7,18},{8,18},{9,18},{10,18},{11,18},{12,18},{12,17},{12,16},{12,15},{12,14},{12,13},{12,12},{11,12},{10,12},{9,12},{8,12},{7,12},{6,12},{5,12},{4,12},{3,12},{3,11},{3,10},{3,9},{3,8},{3,7},{3,6},{3,5},{3,4},{3,3},{4,3},{5,3},{6,3},{7,3},{8,3},{9,3},{10,3},{11,3},{12,3},{13,3},{14,3},{15,3},{16,3},{17,3},{18,3},{19,3},{19,4},{19,5},{19,6},{19,7},{19,8},{19,9},{19,10},{20,10},{21,10},{22,10},{23,10},{24,10},{24,11},{24,12},{24,13},{24,14},{24,15},{24,16},{24,17},{24,18},{24,19},{24,20},{24,21},{24,22},{24,23},{24,24},{25,24},{26,24},{27,24},{28,24},{29,24}}; @@ -26,9 +30,8 @@ public class MapCreatureController { int min = 1; double a = Math.random() * ( max - min ); int numCreature = (int) Math.round(a) + min; - + int j = 1; if(lv == 1) { - int j = 1; if(numCreature == 1) { coordList = coord1Lv1; } @@ -43,10 +46,32 @@ public class MapCreatureController { } } if(lv == 2) { - + if(numCreature == 1) { + coordList = coord1Lv2; + } + if (numCreature == 2) { + coordList = coord2Lv2; + } + for(int[] i : coordList){ + boolean bool = j == 1; + Case case1 = new Case(j, i[0], i [1], bool,false,false, false, map); + mapCreature.addCase(case1); + j++; + } } if(lv == 3) { - + if(numCreature == 1) { + coordList = coord1Lv3; + } + if (numCreature == 2) { + coordList = coord2Lv3; + } + for(int[] i : coordList){ + boolean bool = j == 1; + Case case1 = new Case(j, i[0], i [1], bool,false,false, false, map); + mapCreature.addCase(case1); + j++; + } } } public MapCreature getMap(){ diff --git a/code/src/model/GameLoop.java b/code/src/model/GameLoop.java index 13aa383..ba357f3 100644 --- a/code/src/model/GameLoop.java +++ b/code/src/model/GameLoop.java @@ -24,7 +24,7 @@ public class GameLoop { c = new CreatureController(lv,map, creatureImageView); timer = new Thread("timer") { public void run() { - int nbSeconde = 40; + int nbSeconde = 50; int i = 0; while(true) { if(i == 0) {