From 997f30356796fe358d1585df98d28e7e7bb9c2e1 Mon Sep 17 00:00:00 2001 From: Fastium <79766552+Fastium@users.noreply.github.com> Date: Wed, 15 Jun 2022 08:20:28 +0200 Subject: [PATCH] a --- src/Main/PokeMudry.java | 7 ++--- src/Screen/ScreenPlayer-MSI.java | 45 ++++++++++++++++++++++++++++++++ src/Screen/ScreenPlayer.java | 2 +- 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 src/Screen/ScreenPlayer-MSI.java diff --git a/src/Main/PokeMudry.java b/src/Main/PokeMudry.java index 94e05b0..832c4e7 100644 --- a/src/Main/PokeMudry.java +++ b/src/Main/PokeMudry.java @@ -75,16 +75,17 @@ public class PokeMudry extends PortableApplication { //manage battle if(!sp.b.getScreenBattleOn()){ + sp.p.addXp(sp.b.getNewXp()); + sp.e.removedPv(sp.b.getNewXp()); sp.b.setPvEnemy(sp.e.getPv()); sp.b.setXpPlayer(sp.p.getXp()); } - if(!sp.b.getScreenBattleOn() && onBattleScreen){ sp.p.onEnemy = false; sp.sm = sp.screenManager.getScreenMap(); - sp.p.addXp(sp.b.getNewXp()); - sp.e.removedPv(sp.b.getNewXp()); + + } // Graphics render diff --git a/src/Screen/ScreenPlayer-MSI.java b/src/Screen/ScreenPlayer-MSI.java new file mode 100644 index 0000000..04197ed --- /dev/null +++ b/src/Screen/ScreenPlayer-MSI.java @@ -0,0 +1,45 @@ +package Screen; + +import Entity.Enemy; +import Entity.Player; +import Game.Battle; +import ch.hevs.gdx2d.lib.GdxGraphics; + +public class ScreenPlayer { + public ManagerOfScreen screenManager = new ManagerOfScreen(); + public Player p = null; + public Enemy e = null; + public Battle b = null; + public ScreenMap sm = null; + public ScreenBattle sb = null; + + public void init(){ + + // One player by ScreenPlayer + p = new Player(8, 15, "desert"); + //p = new Player(4, 2, "21RI"); + + b = new Battle(new Enemy("enemi", 0, 0, "charachter", "desert", 50, "enemi")); + + // Create both type of screen and record for reuse + screenManager.registerScreen(ScreenMap.class); + screenManager.registerScreen(ScreenBattle.class); + sb = screenManager.getScreenBattle(); + sm = screenManager.getScreenMap(); + + } + + public void render(GdxGraphics g){ + if(sm != null){ + sm.setPlayer(p); + } + + if(sb != null){ + sb.setBattle(b); + b.setEnemy(e); + } + + screenManager.render(g); + } + +} \ No newline at end of file diff --git a/src/Screen/ScreenPlayer.java b/src/Screen/ScreenPlayer.java index 04197ed..e43af46 100644 --- a/src/Screen/ScreenPlayer.java +++ b/src/Screen/ScreenPlayer.java @@ -17,7 +17,7 @@ public class ScreenPlayer { // One player by ScreenPlayer p = new Player(8, 15, "desert"); - //p = new Player(4, 2, "21RI"); + // = new Player(4, 2, "21RI"); b = new Battle(new Enemy("enemi", 0, 0, "charachter", "desert", 50, "enemi"));