diff --git a/src/Control/Controller.java b/src/Control/Controller.java index 079acf0..9326e6d 100644 --- a/src/Control/Controller.java +++ b/src/Control/Controller.java @@ -19,6 +19,7 @@ public class Controller { keyStatus.put(Input.Keys.NUM_3, false); keyStatus.put(Input.Keys.NUM_4, false); keyStatus.put(Input.Keys.SPACE, false); + keyStatus.put(Input.Keys.ENTER, false); } } diff --git a/src/Game/Battle.java b/src/Game/Battle.java index a4c98c0..3b317f4 100644 --- a/src/Game/Battle.java +++ b/src/Game/Battle.java @@ -31,8 +31,10 @@ public class Battle { public void readNextLine(){ //change line - lineSpeech++; - + System.out.println(textEnemy.lines.size()); + if(lineSpeech < textEnemy.lines.size()-1){ + lineSpeech++; + } } //check the choice answer @@ -66,6 +68,11 @@ public class Battle { } + + public boolean finish(){ + return false; + } + public boolean getAttackOn(){ return textEnemy.lines.get(lineSpeech).attackOn; } diff --git a/src/Main/PokeMudry.java b/src/Main/PokeMudry.java index 372370d..5fd0a40 100644 --- a/src/Main/PokeMudry.java +++ b/src/Main/PokeMudry.java @@ -71,6 +71,12 @@ public class PokeMudry extends PortableApplication { if(onBattleScreen) sp.sb.manage(controller, sp.b); + + if(!sp.sb.getScreenBattleOn() && onBattleScreen){ + sp.p.onEnemy = false; + sp.sm = sp.screenManager.getScreenMap(); + } + // Graphics render sp.render(g); for (Entity entity : entities) { diff --git a/src/Screen/ScreenBattle.java b/src/Screen/ScreenBattle.java index d042081..d64c2f8 100644 --- a/src/Screen/ScreenBattle.java +++ b/src/Screen/ScreenBattle.java @@ -28,6 +28,8 @@ public class ScreenBattle extends RenderingScreen{ private Battle b = null; + private boolean screenBattleOn = true; + @Override public void onInit() { //display the question @@ -89,6 +91,10 @@ public class ScreenBattle extends RenderingScreen{ //TODO afficher le joueur } + public boolean getScreenBattleOn(){ + return screenBattleOn; + } + public void manage(Controller c, Battle battle){ if(PokeMudry.front_montant){ System.out.println("manage: " + battle.getLineSpeech()); @@ -98,6 +104,9 @@ public class ScreenBattle extends RenderingScreen{ System.out.println("in"); battle.readNextLine(); } + if (c.keyStatus.get(Input.Keys.ENTER)){ + screenBattleOn = battle.finish(); + } } if(battle.getAttackOn() == true){ diff --git a/src/Screen/ScreenPlayer.java b/src/Screen/ScreenPlayer.java index 375bc3f..1b7146a 100644 --- a/src/Screen/ScreenPlayer.java +++ b/src/Screen/ScreenPlayer.java @@ -21,6 +21,7 @@ public class ScreenPlayer { // Create both type of screen and record for reuse screenManager.registerScreen(ScreenMap.class); screenManager.registerScreen(ScreenBattle.class); + sb = screenManager.getScreenBattle(); sm = screenManager.getScreenMap(); }