diff --git a/src/Game/Battle.java b/src/Game/Battle.java index c71fb08..b70f493 100644 --- a/src/Game/Battle.java +++ b/src/Game/Battle.java @@ -8,5 +8,7 @@ public class Battle { * réponses juste * barre de vie */ + + } diff --git a/src/Main/PokeMudry.java b/src/Main/PokeMudry.java index 0ea5a6c..55833c5 100644 --- a/src/Main/PokeMudry.java +++ b/src/Main/PokeMudry.java @@ -21,6 +21,8 @@ public class PokeMudry extends PortableApplication { private static Vector enemies = new Vector<>(); private static Vector entities = new Vector<>(); + public static boolean front_montant = false; + public static void main(String[] args) { new PokeMudry(); @@ -74,7 +76,7 @@ public class PokeMudry extends PortableApplication { @Override public void onKeyDown(int keycode) { super.onKeyDown(keycode); - + front_montant = true; switch (keycode) { case Input.Keys.Z: if (sp.sm.zoom == 1.0) { @@ -93,6 +95,7 @@ public class PokeMudry extends PortableApplication { @Override public void onKeyUp(int keycode) { super.onKeyUp(keycode); + front_montant = false; controller.keyStatus.put(keycode, false); sp.screenManager.getActiveScreen().onKeyDown(keycode); } diff --git a/src/Screen/ScreenBattle.java b/src/Screen/ScreenBattle.java index b90f597..d98fa5b 100644 --- a/src/Screen/ScreenBattle.java +++ b/src/Screen/ScreenBattle.java @@ -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; } + } - - - + } } diff --git a/src/testYann.java b/src/testYann.java index 037fc91..72b4da4 100644 --- a/src/testYann.java +++ b/src/testYann.java @@ -5,13 +5,14 @@ import java.util.TreeMap; import Control.Controller; import Entity.Enemy; import Screen.ScreenBattle; +import Screen.ScreenPlayer; import ch.hevs.gdx2d.desktop.PortableApplication; import ch.hevs.gdx2d.lib.GdxGraphics; import ch.hevs.gdx2d.lib.ScreenManager; public class testYann extends PortableApplication{ - private ScreenManager s = new ScreenManager(); + ScreenPlayer sp = new ScreenPlayer(); public Map keyStatus = new TreeMap(); double zoom; Controller controller = new Controller(); @@ -28,15 +29,16 @@ public class testYann extends PortableApplication{ @Override public void onInit() { - s.registerScreen(ScreenBattle.class); + Enemy e = new Enemy("enemi", 50, 50, "resources//lumberjack_sheet32.png", "desert"); } @Override public void onGraphicRender(GdxGraphics g) { - s.render(g); - + + sp.render(g); + sp.sb.manage(controller); } @Override