From 3ed33526d45a959987fb440662cc5b671b56b128 Mon Sep 17 00:00:00 2001 From: Jonathan Hager Date: Wed, 1 Apr 2020 01:09:50 +0200 Subject: [PATCH] =?UTF-8?q?Item=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/com/dungeoncrawler/Entity.java | 5 +++ core/src/com/dungeoncrawler/Item.java | 35 +++++++++++++++++++ .../com/dungeoncrawler/entities/Archer.java | 13 +++++-- .../com/dungeoncrawler/entities/Player.java | 15 +++++++- .../dungeoncrawler/entities/Swordsman.java | 15 +++++++- core/src/com/dungeoncrawler/items/Key.java | 20 +++++++++++ core/src/com/dungeoncrawler/items/Potion.java | 20 +++++++++++ core/src/com/dungeoncrawler/items/Sword.java | 20 +++++++++++ .../desktop/DesktopLauncher.java | 8 ++--- 9 files changed, 142 insertions(+), 9 deletions(-) create mode 100644 core/src/com/dungeoncrawler/Item.java create mode 100644 core/src/com/dungeoncrawler/items/Key.java create mode 100644 core/src/com/dungeoncrawler/items/Potion.java create mode 100644 core/src/com/dungeoncrawler/items/Sword.java diff --git a/core/src/com/dungeoncrawler/Entity.java b/core/src/com/dungeoncrawler/Entity.java index 539ef6d..082bae4 100644 --- a/core/src/com/dungeoncrawler/Entity.java +++ b/core/src/com/dungeoncrawler/Entity.java @@ -10,6 +10,11 @@ public abstract class Entity { protected int dmg; protected int lvl; + public Entity(int xPos, int yPos, int lvl){ + this.xPos = xPos; + this.yPos = yPos; + this.lvl = lvl; + } public void attack(){ diff --git a/core/src/com/dungeoncrawler/Item.java b/core/src/com/dungeoncrawler/Item.java new file mode 100644 index 0000000..e5404fa --- /dev/null +++ b/core/src/com/dungeoncrawler/Item.java @@ -0,0 +1,35 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.dungeoncrawler; + +/** + * + * @author jonathan + */ +public abstract class Item { + private int amount; + + public Item(int amount){ + this.amount = amount; + } + + /** + * @return the amount + */ + public int getAmount() { + return amount; + } + + /** + * @param amount the amount to set + */ + public void setAmount(int amount) { + this.amount = amount; + } + + +} + diff --git a/core/src/com/dungeoncrawler/entities/Archer.java b/core/src/com/dungeoncrawler/entities/Archer.java index f52d5c2..6612fdc 100644 --- a/core/src/com/dungeoncrawler/entities/Archer.java +++ b/core/src/com/dungeoncrawler/entities/Archer.java @@ -3,8 +3,15 @@ import com.dungeoncrawler.Entity; public class Archer extends Entity{ - public Archer(int ebene, int x, int y){ - this.hp = 10; + public Archer(int xPos, int yPos, int lvl) { + super(xPos, yPos, lvl); + + this.maxhp = 5*lvl; + this.hp = this.maxhp; + + this.dmg = 3*lvl; + + // TODO: Sinnvolle Werte finden } - + } diff --git a/core/src/com/dungeoncrawler/entities/Player.java b/core/src/com/dungeoncrawler/entities/Player.java index 5a951eb..36c25b9 100644 --- a/core/src/com/dungeoncrawler/entities/Player.java +++ b/core/src/com/dungeoncrawler/entities/Player.java @@ -5,10 +5,23 @@ */ package com.dungeoncrawler.entities; + +import com.dungeoncrawler.Entity; /** * * @author Jan */ -public class Player { +public class Player extends Entity { + + public Player(int xPos, int yPos, int lvl) { + super(xPos, yPos, lvl); + + this.maxhp = 5*lvl; + this.hp = this.maxhp; + + this.dmg = 3*lvl; + + // TODO: Sinnvolle Werte finden + } } diff --git a/core/src/com/dungeoncrawler/entities/Swordsman.java b/core/src/com/dungeoncrawler/entities/Swordsman.java index cc9aedb..473c2ee 100644 --- a/core/src/com/dungeoncrawler/entities/Swordsman.java +++ b/core/src/com/dungeoncrawler/entities/Swordsman.java @@ -5,10 +5,23 @@ */ package com.dungeoncrawler.entities; +import com.dungeoncrawler.Entity; + /** * * @author Jan */ -public class Swordsman { +public class Swordsman extends Entity { + + public Swordsman(int xPos, int yPos, int lvl) { + super(xPos, yPos, lvl); + + this.maxhp = 5*lvl; + this.hp = this.maxhp; + + this.dmg = 3*lvl; + + // TODO: Sinnvolle Werte finden + } } diff --git a/core/src/com/dungeoncrawler/items/Key.java b/core/src/com/dungeoncrawler/items/Key.java new file mode 100644 index 0000000..bafebba --- /dev/null +++ b/core/src/com/dungeoncrawler/items/Key.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.dungeoncrawler.items; + +import com.dungeoncrawler.Item; + +/** + * + * @author jonathan + */ +public class Key extends Item { + + public Key(int amount) { + super(amount); + } + +} diff --git a/core/src/com/dungeoncrawler/items/Potion.java b/core/src/com/dungeoncrawler/items/Potion.java new file mode 100644 index 0000000..79af380 --- /dev/null +++ b/core/src/com/dungeoncrawler/items/Potion.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.dungeoncrawler.items; + +import com.dungeoncrawler.Item; + +/** + * + * @author jonathan + */ +public class Potion extends Item { + + public Potion(int amount) { + super(amount); + } + +} diff --git a/core/src/com/dungeoncrawler/items/Sword.java b/core/src/com/dungeoncrawler/items/Sword.java new file mode 100644 index 0000000..4992619 --- /dev/null +++ b/core/src/com/dungeoncrawler/items/Sword.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.dungeoncrawler.items; + +import com.dungeoncrawler.Item; + +/** + * + * @author jonathan + */ +public class Sword extends Item { + + public Sword(int amount) { + super(amount); + } + +} diff --git a/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java b/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java index f2f68a3..cd978d5 100644 --- a/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java +++ b/desktop/src/com/dungeoncrawler/desktop/DesktopLauncher.java @@ -5,8 +5,8 @@ import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.dungeoncrawler.Main; public class DesktopLauncher { - public static void main (String[] arg) { - LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); - new LwjglApplication(new Main(), config); - } + public static void main (String[] arg) { + LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); + new LwjglApplication(new Main(), config); + } }