From b808af6adc17124b966326f9f6d7eb2b27654e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Thu, 16 Jun 2022 16:59:02 +0200 Subject: [PATCH] add pv for player --- src/Entity/Player.java | 6 +++--- src/Main/PokeMudry.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Entity/Player.java b/src/Entity/Player.java index f15b0c7..e3d7d60 100644 --- a/src/Entity/Player.java +++ b/src/Entity/Player.java @@ -20,6 +20,7 @@ public class Player extends Character{ public Player(int x, int y, String map) { super("Player", x, y, "Character_flipped", map); + this.pv = Settings.TIME*60; } public void addXp(int xp){ @@ -119,9 +120,8 @@ public class Player extends Character{ } @Override - protected void removedPv(int pv) { - // TODO Auto-generated method stub - + public void removedPv(int pv) { + this.pv -= pv; } public int getXpMax(){ diff --git a/src/Main/PokeMudry.java b/src/Main/PokeMudry.java index c356cd6..50a1398 100644 --- a/src/Main/PokeMudry.java +++ b/src/Main/PokeMudry.java @@ -68,8 +68,9 @@ public class PokeMudry extends PortableApplication { boolean onBattleScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenBattle.class); long timeNow = System.currentTimeMillis(); - if((timeNow-lastMesure) >= 1000){ + if((timeNow-lastMesure) >= 1000){ // one second lastMesure = timeNow; + sp.p.removedPv(1); for (Enemy enemy : enemies) { enemy.recoveredTime++; } } if((timeNow-beginTime)/1000 >= 60 * Settings.TIME) System.out.println("Game finished");