1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2024-11-26 19:13:27 +00:00

new vector to display speech

This commit is contained in:
Fastium 2022-06-09 06:58:49 +02:00
parent aaeb151c43
commit 0fc97ac683
2 changed files with 23 additions and 12 deletions

View File

@ -22,6 +22,7 @@ public class ScreenBattle extends RenderingScreen{
private static int WIDTH_DIALOG = Settings.SIDE - 2*EDGE; private static int WIDTH_DIALOG = Settings.SIDE - 2*EDGE;
private boolean attackOn; private boolean attackOn;
private int numAttack =0;
private BitmapFont optimus40; private BitmapFont optimus40;
@ -60,14 +61,14 @@ public class ScreenBattle extends RenderingScreen{
} }
public void displayEnemy(Enemy e){ public void displayEnemy(Enemy e){
if(e.textEnemy.attackOn){ // stock his speech
attackOn = true;
} //display the person
else()
} }
public void readNextLine(){ public void readNextLine(){
//display the speech
} }

View File

@ -5,9 +5,8 @@ import java.util.Vector;
public class TextEnemy { public class TextEnemy {
public FightData fightData; public FightData fightData;
public SpeechData speechData; public SpeechData speechData;
public boolean attackOn = false;
Vector<String> line = new Vector<String>(); Vector<Line> line = new Vector<Line>();
public TextEnemy(String name){ public TextEnemy(String name){
//generate the vector of fight //generate the vector of fight
@ -23,20 +22,31 @@ public class TextEnemy {
public void generateText(){ public void generateText(){
int i =0; int i =0;
//introduction line //introduction line
line.add(speechData.getSpeechs(i++)); line.add(new Line(speechData.getSpeechs(i++), false));
for(int j=0; i<4;i++){ for(int j=0; i<4;i++){
//attack and answer (number on vector : 1-4) //attack and answer (number on vector : 1-4)
line.add( line.add(new Line(
speechData.getSpeechs(i++) + fightData.getAttack(j).attack + "? ("+fightData.getAttack(j).xp+ ") " + "\n" + speechData.getSpeechs(i++) + fightData.getAttack(j).attack + "? ("+fightData.getAttack(j).xp+ ") " + "\n" +
fightData.getAttack(j).answer1 + "\n" + fightData.getAttack(j).answer1 + "\n" +
fightData.getAttack(j).answer2 + "\n" + fightData.getAttack(j).answer2 + "\n" +
fightData.getAttack(j).answer3 + "\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) //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;
}
}