From a944dd92ff44d2217f713ef2dc0ea8edc05d90db Mon Sep 17 00:00:00 2001 From: timeo <timeo.jacquier@gmail.com> Date: Wed, 8 Dec 2021 12:47:34 +0100 Subject: [PATCH] =?UTF-8?q?plateformes=20se=20g=C3=A9n=C3=A8rent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/body/Platform.java | 7 +++--- core/src/etat/Play.java | 46 +++++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/core/src/body/Platform.java b/core/src/body/Platform.java index bd209df..9bf8ad6 100644 --- a/core/src/body/Platform.java +++ b/core/src/body/Platform.java @@ -24,8 +24,7 @@ public class Platform { if (type.equals("rectangle")) { - ptsStruct = new Vector2[]{}; - + ptsStruct = new Vector2[]{new Vector2(0, 2.5f/PPM), new Vector2(10/PPM, 2.5f/PPM), new Vector2(10/PPM, 10/PPM), new Vector2(0, 10/PPM)}; shapeStruct.set(ptsStruct); } @@ -35,12 +34,12 @@ public class Platform { } if (type.equals("bord_gauche")){ - ptsStruct = new Vector2[]{}; + ptsStruct = new Vector2[]{new Vector2(0, 5/PPM), new Vector2(0, 10/PPM), new Vector2(10/PPM, 10/PPM), new Vector2(10/PPM, 2.5f/PPM), new Vector2(5/PPM, 2.5f/PPM)}; shapeStruct.set(ptsStruct); } if (type.equals("bord_droit")){ - ptsStruct = new Vector2[]{}; + ptsStruct = new Vector2[]{new Vector2(0, 2.5f/PPM), new Vector2(0, 10/PPM), new Vector2(10/PPM, 10/PPM), new Vector2(10/PPM, 5/PPM), new Vector2(5/PPM, 2.5f/PPM)}; shapeStruct.set(ptsStruct); } diff --git a/core/src/etat/Play.java b/core/src/etat/Play.java index 2d1a5ee..4a96181 100644 --- a/core/src/etat/Play.java +++ b/core/src/etat/Play.java @@ -108,12 +108,44 @@ public class Play extends GameState { hauteur = Integer.parseInt(premiereLigne[1]); temps = Integer.parseInt(premiereLigne[2]); - for (int i = 1; i < (hauteur+1); i++){ + + for (int i = hauteur; i > 0; i--){ for (int j = 0; j < largeur; j++){ + System.out.print(ligne[i].charAt(j)); char current = ligne[i].charAt(j); + switch (current){ + case 'K': + new Platform((j*10)/PPM, ((hauteur-i)*10)/PPM, "rectangle", world); + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + new Platform((j*10)/PPM, ((hauteur-i)*10)/PPM, "carre", world); + break; + case 'L': + new Platform((j*10)/PPM, ((hauteur-i)*10)/PPM, "bord_droit", world); + break; + case 'J': + new Platform((j*10)/PPM, ((hauteur-i)*10)/PPM, "bord_gauche", world); + break; + } + } + + System.out.println(); + } + + /* for (int i = hauteur; i >= 0; i--){ + for (int j = 0; j < largeur; j++){ + char current = ligne[i-1].charAt(j); System.out.print(current); switch (current){ - /*case 'J': + *//*case 'J': new Platform(j, i, "bord_gauche", world); break; case 'K': @@ -121,7 +153,7 @@ public class Play extends GameState { break; case 'L': new Platform(j, i, "bord_droit", world); - break;*/ + break;*//* case 'A': case 'B': case 'C': @@ -131,9 +163,9 @@ public class Play extends GameState { case 'G': case 'H': case 'I': - new Platform((j*10)/PPM, ((i-1)*10)/PPM, "carre", world); + new Platform((j*10)/PPM, ((i)*10)/PPM, "carre", world); break; - /*case 'W': + *//*case 'W': new Water(j, i, world); break; case 'Z': @@ -142,12 +174,12 @@ public class Play extends GameState { case '1': case '2': //new Joyau(j, i, FabriqueUnite.getUnite(), world); - break;*/ + break;*//* } } System.out.println(); - } + }*/ } -- GitLab