From 0fc97ac683faa89b107e15bfff26eda9218656dd Mon Sep 17 00:00:00 2001 From: Fastium Date: Thu, 9 Jun 2022 06:58:49 +0200 Subject: [PATCH] new vector to display speech --- src/Screen/ScreenBattle.java | 11 ++++++----- src/Text/TextEnemy.java | 24 +++++++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Screen/ScreenBattle.java b/src/Screen/ScreenBattle.java index b23f5bb..3ee7029 100644 --- a/src/Screen/ScreenBattle.java +++ b/src/Screen/ScreenBattle.java @@ -22,6 +22,7 @@ public class ScreenBattle extends RenderingScreen{ private static int WIDTH_DIALOG = Settings.SIDE - 2*EDGE; private boolean attackOn; + private int numAttack =0; private BitmapFont optimus40; @@ -60,14 +61,14 @@ public class ScreenBattle extends RenderingScreen{ } public void displayEnemy(Enemy e){ - if(e.textEnemy.attackOn){ - attackOn = true; - } - else() + // stock his speech + + //display the person + } public void readNextLine(){ - + //display the speech } diff --git a/src/Text/TextEnemy.java b/src/Text/TextEnemy.java index 2532472..c370f29 100644 --- a/src/Text/TextEnemy.java +++ b/src/Text/TextEnemy.java @@ -5,9 +5,8 @@ import java.util.Vector; public class TextEnemy { public FightData fightData; public SpeechData speechData; - public boolean attackOn = false; - Vector line = new Vector(); + Vector line = new Vector(); public TextEnemy(String name){ //generate the vector of fight @@ -23,20 +22,31 @@ public class TextEnemy { public void generateText(){ int i =0; //introduction line - line.add(speechData.getSpeechs(i++)); + line.add(new Line(speechData.getSpeechs(i++), false)); for(int j=0; i<4;i++){ - //attack and answer (number on vector : 1-4) - line.add( + //attack and answer (number on vector : 1-4) + line.add(new Line( speechData.getSpeechs(i++) + fightData.getAttack(j).attack + "? ("+fightData.getAttack(j).xp+ ") " + "\n" + fightData.getAttack(j).answer1 + "\n" + fightData.getAttack(j).answer2 + "\n" + fightData.getAttack(j).answer3 + "\n" + - fightData.getAttack(j).answer4); + fightData.getAttack(j).answer4, true )); + // TODO mélanger les attaques aléatoirement } //finish (win and death) - + line.add(new Line(speechData.getSpeechs(i++), false)); + line.add(new Line(speechData.getSpeechs(i++), false)); } } +class Line { + String line; + boolean attackOn; + + Line( String line, boolean attackOn){ + this.line = line; + this.attackOn = attackOn; + } +}