From ad7432ce027a7b8745b78fb1ab8c0dd02c53adc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Mon, 20 Jun 2022 22:44:45 +0200 Subject: [PATCH] fix last answer --- src/Game/Battle.java | 5 +++-- src/Screen/ScreenBattle.java | 12 ++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Game/Battle.java b/src/Game/Battle.java index 03b4f07..aad842f 100644 --- a/src/Game/Battle.java +++ b/src/Game/Battle.java @@ -45,10 +45,9 @@ public class Battle { } public void action(int answer){ - textEnemy.randomAnswer(); - //the player is at the last question, the finish text must be displayed if(getLineSpeech() == 4){ + checkAnswer(answer); finishSpeech(); } //the player is at the finish text and he must quit the battle @@ -67,6 +66,8 @@ public class Battle { else{ readNextLine(); } + + textEnemy.randomAnswer(); } //check the choice answer diff --git a/src/Screen/ScreenBattle.java b/src/Screen/ScreenBattle.java index 0e2c854..b2caa1b 100644 --- a/src/Screen/ScreenBattle.java +++ b/src/Screen/ScreenBattle.java @@ -115,20 +115,16 @@ public class ScreenBattle extends RenderingScreen{ //add a rising front to have one impulsion if(PokeHES.risingFront){ - if (c.keyStatus.get(Input.Keys.DOWN)){ - battle.cursor++; - } - else if (c.keyStatus.get(Input.Keys.UP)){ - battle.cursor--; - } - + if (c.keyStatus.get(Input.Keys.DOWN)){ battle.cursor++; } + else if (c.keyStatus.get(Input.Keys.UP)){ battle.cursor--; } + if (battle.cursor > 3) battle.cursor = 0; if (battle.cursor < 0) battle.cursor = 3; if( battle.getAttackOn() == false){ //the enemy is attacking if (c.keyStatus.get(Input.Keys.SPACE) || c.keyStatus.get(Input.Keys.A)){ battle.action(-1); - battle.cursor = 0; + //battle.cursor = 0; } } else if(battle.getAttackOn() == true){ //the enemy is speaking if (c.keyStatus.get(Input.Keys.NUM_1) || c.keyStatus.get(Input.Keys.A) && b.cursor == 0){