From 537e0c8b5e5434c9891f8b6e3a5544d8ba24b3fe Mon Sep 17 00:00:00 2001 From: 04Mlg04 <74152989+04Mlg04@users.noreply.github.com> Date: Wed, 23 Jun 2021 16:09:03 +0200 Subject: [PATCH] Hp added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getHealthpoints method+ lönk's hp --- Zoelda/src/main/LivingEntity.java | 6 +++++- Zoelda/src/main/Player.java | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Zoelda/src/main/LivingEntity.java b/Zoelda/src/main/LivingEntity.java index b517a25..c58d6d4 100644 --- a/Zoelda/src/main/LivingEntity.java +++ b/Zoelda/src/main/LivingEntity.java @@ -12,7 +12,7 @@ public class LivingEntity extends Entity { protected ActionFigur actionFigur; // Sprite des Entities protected float spriteScale = 1f; // Skalierung des Sprites protected float spriteOffsetX, spriteOffsetY; // Offset des Sprites. Hier kann man die relative render-Position nachjustieren. - + protected float hp; //hp des Entitys /** * @param figur - erstes (standart) Sprite * @param name - name des Zustands @@ -70,4 +70,8 @@ public class LivingEntity extends Entity { actionFigur.spiegelXSetzen(side); actionFigur.zustandSetzen(name); } + + protected float getHealthPoints() { + return hp; + } } diff --git a/Zoelda/src/main/Player.java b/Zoelda/src/main/Player.java index 8245eeb..845e49b 100644 --- a/Zoelda/src/main/Player.java +++ b/Zoelda/src/main/Player.java @@ -18,7 +18,8 @@ public class Player extends LivingEntity { spriteScale = 0.8f; posX = 4f; posY = 4f; - + hp = 10f; + // unterschiedliche Animationsgeschwindigkeiten // für idle loader.getPlayer(0).animationsGeschwindigkeitSetzen(200);