1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-10-30 11:19:17 +00:00
This commit is contained in:
Fastium
2022-06-11 21:45:45 +02:00
parent f21a8c7482
commit d33945ccf4
4 changed files with 61 additions and 43 deletions

View File

@@ -10,14 +10,15 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
import com.badlogic.gdx.utils.Align;
import Control.Controller;
import Entity.Enemy;
import Entity.Player;
import Game.Battle;
import Text.Line;
import Text.TextEnemy;
import Main.PokeMudry;
import Main.Settings;
public class ScreenBattle extends RenderingScreen{
@@ -29,11 +30,14 @@ public class ScreenBattle extends RenderingScreen{
private BitmapFont optimus40;
private TextEnemy textEnemy;
private int lineSpeech = 0;
private String lineDialog = "";
private Battle battle;
private int answer = 0;
private TextEnemy textEnemy;
private static int lineSpeech = 0;
private static String lineDialog = "";
int i = 0;
private int answer = 0;
@@ -44,30 +48,34 @@ public class ScreenBattle extends RenderingScreen{
textEnemy = new TextEnemy("enemi");
textEnemy.generateText();
//new battle game
battle = new Battle();
//display the question
generateFont("resources/font/OptimusPrinceps.ttf", 40, Color.BLACK);
//initialize the first line
readNextLine();
System.out.println(1);
}
@Override
public void onGraphicRender(GdxGraphics g) {
g.clear(Color.BLACK);
displayDialog(g);
}
@Override
public void dispose() {
optimus40.dispose();
}
public void generateFont(String file, int height, Color c ){
@@ -84,7 +92,7 @@ public class ScreenBattle extends RenderingScreen{
public void displayDialog(GdxGraphics g){
//dialog background
g.drawFilledRectangle(Settings.SIDE/2, HEIGHT_DIALOG/2 + EDGE, 1600, HEIGHT_DIALOG, 0);
g.drawFilledRectangle(Settings.SIDE/2, HEIGHT_DIALOG/2 + EDGE, WIDTH_DIALOG, HEIGHT_DIALOG, 0);
//dialog
g.drawString(15, 245 ,lineDialog , optimus40);
@@ -93,7 +101,7 @@ public class ScreenBattle extends RenderingScreen{
public void displayEnemy(Enemy e){
// TODO affficher l'enemi
}
}
public void displayPlayer(Player p){
//TODO afficher le joueur
@@ -106,41 +114,44 @@ public class ScreenBattle extends RenderingScreen{
}
public void manage(Controller c){
if (c.keyStatus.get(Input.Keys.SPACE)){
if(textEnemy.lines.get(lineSpeech).attackOn == false){
readNextLine();
if(PokeMudry.front_montant){
if (c.keyStatus.get(Input.Keys.SPACE)){
if(textEnemy.lines.get(lineSpeech).attackOn == false){
readNextLine();
}
}
if (c.keyStatus.get(Input.Keys.NUM_1)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 1;
else if (c.keyStatus.get(Input.Keys.NUM_1)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 1;
}
}
}
if (c.keyStatus.get(Input.Keys.NUM_2)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 2;
else if (c.keyStatus.get(Input.Keys.NUM_2)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 2;
}
}
}
if (c.keyStatus.get(Input.Keys.NUM_3)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 3;
else if (c.keyStatus.get(Input.Keys.NUM_3)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 3;
}
}
}
if (c.keyStatus.get(Input.Keys.NUM_4)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 4;
else if (c.keyStatus.get(Input.Keys.NUM_4)){
if(textEnemy.lines.get(lineSpeech).attackOn == true){
readNextLine();
answer = 4;
}
}
//mettre le front à false jusqu'à ce que le bouton soit relâché
PokeMudry.front_montant = false;
}
}
}
}