mirror of
https://github.com/Klagarge/PokeHES.git
synced 2024-11-23 01:43:28 +00:00
select answer with row
This commit is contained in:
parent
62716a5077
commit
2e034c4f85
@ -25,6 +25,7 @@ public class Controller {
|
|||||||
keyStatus.put(Input.Keys.NUM_3, false);
|
keyStatus.put(Input.Keys.NUM_3, false);
|
||||||
keyStatus.put(Input.Keys.NUM_4, false);
|
keyStatus.put(Input.Keys.NUM_4, false);
|
||||||
keyStatus.put(Input.Keys.SPACE, false);
|
keyStatus.put(Input.Keys.SPACE, false);
|
||||||
|
keyStatus.put(Input.Keys.A, false);
|
||||||
keyStatus.put(Input.Keys.ENTER, false);
|
keyStatus.put(Input.Keys.ENTER, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,14 @@ public class Battle {
|
|||||||
public int xpPlayer;
|
public int xpPlayer;
|
||||||
|
|
||||||
public boolean screenBattleOn = true;
|
public boolean screenBattleOn = true;
|
||||||
|
public int cursor = 0;
|
||||||
|
|
||||||
public Battle(Enemy e){
|
public Battle(Enemy e){
|
||||||
if(e != null){
|
if(e != null){
|
||||||
textEnemy = new TextEnemy(e);
|
textEnemy = new TextEnemy(e);
|
||||||
textEnemy.generateText();
|
textEnemy.generateText(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
pvEnemy = e.getPv();
|
pvEnemy = e.getPv();
|
||||||
lineSpeech = 0;
|
lineSpeech = 0;
|
||||||
newXp = 0;
|
newXp = 0;
|
||||||
|
@ -46,6 +46,7 @@ public class PokeHES extends PortableApplication {
|
|||||||
sp.init();
|
sp.init();
|
||||||
controller.init();
|
controller.init();
|
||||||
|
|
||||||
|
enemies.add(new Enemy("Mudry", 5, 6, "21RI", 700, "informatique"));
|
||||||
// add player, create and add all enemies in entities
|
// add player, create and add all enemies in entities
|
||||||
entities.add((Entity) sp.p);
|
entities.add((Entity) sp.p);
|
||||||
enemies.add(new Enemy("Gloeckner", 1, 7, "21N307", 600, "allemand"));
|
enemies.add(new Enemy("Gloeckner", 1, 7, "21N307", 600, "allemand"));
|
||||||
|
@ -109,24 +109,37 @@ public class ScreenBattle extends RenderingScreen{
|
|||||||
public void manage(Controller c, Battle battle){
|
public void manage(Controller c, Battle battle){
|
||||||
//add a rising front to have one impulsion
|
//add a rising front to have one impulsion
|
||||||
if(PokeHES.risingFront){
|
if(PokeHES.risingFront){
|
||||||
//the enemi is attacking
|
//the enemy is attacking
|
||||||
if( battle.getAttackOn() == false){
|
if( battle.getAttackOn() == false){
|
||||||
if (c.keyStatus.get(Input.Keys.SPACE)){
|
if (c.keyStatus.get(Input.Keys.SPACE) || c.keyStatus.get(Input.Keys.A)){
|
||||||
battle.action(-1);
|
battle.action(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//the enemi is speaking
|
|
||||||
|
if (c.keyStatus.get(Input.Keys.DOWN)){
|
||||||
|
b.cursor++;
|
||||||
|
}
|
||||||
|
else if (c.keyStatus.get(Input.Keys.UP)){
|
||||||
|
b.cursor--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.cursor>3)b.cursor =0;
|
||||||
|
if (b.cursor<0)b.cursor =3;
|
||||||
|
|
||||||
|
System.out.println("" + b.cursor);
|
||||||
|
|
||||||
|
//the enemy is speaking
|
||||||
if(battle.getAttackOn() == true){
|
if(battle.getAttackOn() == true){
|
||||||
if (c.keyStatus.get(Input.Keys.NUM_1)){
|
if (c.keyStatus.get(Input.Keys.NUM_1) || c.keyStatus.get(Input.Keys.A) && b.cursor == 0){
|
||||||
battle.action(1);
|
battle.action(1);
|
||||||
}
|
}
|
||||||
else if (c.keyStatus.get(Input.Keys.NUM_2)){
|
else if (c.keyStatus.get(Input.Keys.NUM_2) || c.keyStatus.get(Input.Keys.A) && b.cursor == 1){
|
||||||
battle.action(2);
|
battle.action(2);
|
||||||
}
|
}
|
||||||
else if (c.keyStatus.get(Input.Keys.NUM_3)){
|
else if (c.keyStatus.get(Input.Keys.NUM_3) || c.keyStatus.get(Input.Keys.A) && b.cursor == 2){
|
||||||
battle.action(3);
|
battle.action(3);
|
||||||
}
|
}
|
||||||
else if (c.keyStatus.get(Input.Keys.NUM_4)){
|
else if (c.keyStatus.get(Input.Keys.NUM_4) || c.keyStatus.get(Input.Keys.A) && b.cursor == 3){
|
||||||
battle.action(4);
|
battle.action(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package Text;
|
|||||||
|
|
||||||
import Entity.Enemy;
|
import Entity.Enemy;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.text.Normalizer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ public class TextEnemy {
|
|||||||
|
|
||||||
|
|
||||||
//generate the text who is displays in battle screen
|
//generate the text who is displays in battle screen
|
||||||
public void generateText(){
|
public void generateText(int cursor){
|
||||||
int i =1;
|
int i =1;
|
||||||
|
|
||||||
//introduction line
|
//introduction line
|
||||||
@ -88,13 +89,16 @@ public class TextEnemy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Format the line
|
//Format the line
|
||||||
|
String[] row = new String[4];
|
||||||
|
row[0] = row[1] = row[2] = row[3] = "";
|
||||||
|
row[cursor] = "->";
|
||||||
String attack = formatLine(speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ("+fightData.getAttack(orderAttack[j]).getXp()+ ") ", CUT);
|
String attack = formatLine(speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ("+fightData.getAttack(orderAttack[j]).getXp()+ ") ", CUT);
|
||||||
String answer1 = formatLine("1. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) , CUT);
|
String answer1 = formatLine(row[0] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) , CUT);
|
||||||
String answer2 = formatLine("2. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) , CUT);
|
String answer2 = formatLine(row[1] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) , CUT);
|
||||||
String answer3 = formatLine("3. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) , CUT);
|
String answer3 = formatLine(row[2] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) , CUT);
|
||||||
String answer4 = formatLine("4. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[3]) , CUT);
|
String answer4 = formatLine(row[3] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[3]) , CUT);
|
||||||
|
|
||||||
//attack and answer (number on vector : 1-4)
|
//attack and answer (number on vector : 1-4)
|
||||||
lines.add(new Line(attack + "\n" +answer1 + "\n" + answer2 + "\n" + answer3 + "\n" + answer4, true));
|
lines.add(new Line(attack + "\n" +answer1 + "\n" + answer2 + "\n" + answer3 + "\n" + answer4, true));
|
||||||
|
|
||||||
//save the order of the answer
|
//save the order of the answer
|
||||||
|
Loading…
Reference in New Issue
Block a user