Skip to content
Snippets Groups Projects
Commit 27634a76 authored by timeo's avatar timeo
Browse files

blocage de cam en x et y + exit le jeu avec esc

parent b7390eac
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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];
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment