1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2024-11-26 19:13:27 +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

@ -9,4 +9,6 @@ public class Battle {
* barre de vie
*/
}

View File

@ -21,6 +21,8 @@ public class PokeMudry extends PortableApplication {
private static Vector<Enemy> enemies = new Vector<>();
private static Vector<Entity> 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);
}

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,9 +30,12 @@ public class ScreenBattle extends RenderingScreen{
private BitmapFont optimus40;
private Battle battle;
private TextEnemy textEnemy;
private int lineSpeech = 0;
private String lineDialog = "";
private static int lineSpeech = 0;
private static String lineDialog = "";
int i = 0;
private int answer = 0;
@ -44,7 +48,8 @@ public class ScreenBattle extends RenderingScreen{
textEnemy = new TextEnemy("enemi");
textEnemy.generateText();
//new battle game
battle = new Battle();
//display the question
@ -53,21 +58,24 @@ public class ScreenBattle extends RenderingScreen{
//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);
@ -106,41 +114,44 @@ public class ScreenBattle extends RenderingScreen{
}
public void manage(Controller c){
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)){
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)){
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)){
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)){
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;
}
}
}
}

View File

@ -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<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>();
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