diff --git a/core/src/etat/Play.java b/core/src/etat/Play.java index 771daaa56889716e2e086664891f985ecda9e36d..8f4378ce2fb380a3bfab6a81e1e80fcbea7a2191 100644 --- a/core/src/etat/Play.java +++ b/core/src/etat/Play.java @@ -89,9 +89,10 @@ public class Play extends GameState { } } + if (InputPerso.isDown(3)){ + Gdx.app.exit(); + } - /*TODO echap pour quitter */ - /*TODO saut écouteur tactile*/ } @Override @@ -131,20 +132,23 @@ public class Play extends GameState { if (isInside()) { cl.setTriggerEndLevel(false); // Bouger la caméra en x - /* TODO bloquer la caméra à droite */ - if (player.getPosition().x * PPM > (float) (PlatVenture.largeur / 2) && player.getPosition().y * PPM <= (float) (PlatVenture.hauteur / 2) + if (player.getPosition().x * PPM > (float) (PlatVenture.largeur / 2) + && player.getPosition().x < ((largeur / 10f)) - PlatVenture.largeur / (2f * PPM) + && player.getPosition().y * PPM <= (float) (PlatVenture.hauteur / 2) && largeur > 16) { b2dCam.position.set(player.getPosition().x, PlatVenture.hauteur / PPM / 2, 0); } // Bouger la caméra en x et y - if (player.getPosition().x * PPM > (float) (PlatVenture.largeur / 2) && player.getPosition().y * PPM > (float) (PlatVenture.hauteur / 2) - && largeur > 16 && hauteur > 12) { + if (player.getPosition().x * PPM > (float) (PlatVenture.largeur / 2) + && player.getPosition().x < ((largeur / 10f)) - PlatVenture.largeur / (2f * PPM) + && player.getPosition().y * PPM > (float) (PlatVenture.hauteur / 2) + && player.getPosition().y * PPM < (float) (3* PlatVenture.hauteur / 4) && hauteur > 12 && largeur > 16) { b2dCam.position.set(player.getPosition().x, player.getPosition().y, 0); } //bouger la caméra en y if (player.getPosition().x * PPM < (float) (PlatVenture.largeur / 2) && player.getPosition().y * PPM > (float) (PlatVenture.hauteur / 2) - && hauteur > 12) { + && player.getPosition().y * PPM < (float) (3* PlatVenture.hauteur / 4) && hauteur > 12) { b2dCam.position.set(PlatVenture.largeur / PPM / 2, player.getPosition().y, 0); } @@ -168,7 +172,7 @@ public class Play extends GameState { batch.draw(res.getTexture("idle_001"), player.getPosition().x - 5f/PPM, player.getPosition().y - 2f/PPM, 1/10f, 1/10f); batch.end(); //dessine le monde box2d - b2dr.render(world, b2dCam.combined); + // b2dr.render(world, b2dCam.combined); } @Override diff --git a/core/src/handlers/InputPerso.java b/core/src/handlers/InputPerso.java index 44d1ca7e1020e058025ad9fbb1ec0d99cbd76330..924e110fb144af65a2858bec783ef05996559d18 100644 --- a/core/src/handlers/InputPerso.java +++ b/core/src/handlers/InputPerso.java @@ -9,7 +9,7 @@ public class InputPerso { public static int x; public static int y; - public static final int NUM_KEYS = 3; + public static final int NUM_KEYS = 4; /** * Saut @@ -24,6 +24,11 @@ public class InputPerso { */ public static final int BUTTON3 = 2; + /** + * Exit + */ + public static final int BUTTON4 = 3; + static{ keys = new boolean[NUM_KEYS]; pkeys = new boolean[NUM_KEYS]; diff --git a/core/src/handlers/InputProcessorPerso.java b/core/src/handlers/InputProcessorPerso.java index ec6de7e1d6d1f5d9961a2c6b26f2ecdc837bf9b4..bf4efeed4fd27272705bf9a10ce9cb79c105c05f 100644 --- a/core/src/handlers/InputProcessorPerso.java +++ b/core/src/handlers/InputProcessorPerso.java @@ -67,6 +67,10 @@ public class InputProcessorPerso extends InputAdapter { if (k == Input.Keys.RIGHT){ InputPerso.setKey(InputPerso.BUTTON3, true); } + + if (k == Input.Keys.ESCAPE){ + InputPerso.setKey(InputPerso.BUTTON4, true); + } return true; }