diff --git a/core/assets/sprites/archer/darkarcher_m.png b/core/assets/sprites/archer/darkarcher_m.png new file mode 100644 index 0000000..98b843c Binary files /dev/null and b/core/assets/sprites/archer/darkarcher_m.png differ diff --git a/core/assets/sprites/archer/darkarcher_w.png b/core/assets/sprites/archer/darkarcher_w.png new file mode 100644 index 0000000..fe0cf83 Binary files /dev/null and b/core/assets/sprites/archer/darkarcher_w.png differ diff --git a/core/assets/sprites/projectile/darkarrow.png b/core/assets/sprites/projectile/darkarrow.png new file mode 100644 index 0000000..46610eb Binary files /dev/null and b/core/assets/sprites/projectile/darkarrow.png differ diff --git a/core/assets/sprites/swordsman/darkswordsman_m.png b/core/assets/sprites/swordsman/darkswordsman_m.png new file mode 100644 index 0000000..827f93e Binary files /dev/null and b/core/assets/sprites/swordsman/darkswordsman_m.png differ diff --git a/core/assets/sprites/swordsman/darkswordsman_w.png b/core/assets/sprites/swordsman/darkswordsman_w.png new file mode 100644 index 0000000..da848f4 Binary files /dev/null and b/core/assets/sprites/swordsman/darkswordsman_w.png differ diff --git a/core/src/com/dungeoncrawler/model/DungeonGenerator.java b/core/src/com/dungeoncrawler/model/DungeonGenerator.java index 53dfdc9..4039d51 100644 --- a/core/src/com/dungeoncrawler/model/DungeonGenerator.java +++ b/core/src/com/dungeoncrawler/model/DungeonGenerator.java @@ -313,7 +313,7 @@ public class DungeonGenerator { Entity temp; - int id = (int) (Math.random() * 14); + int id = (int) (Math.random() * 16); switch(id){ case 0: temp = new Archer(xPos, yPos, lvl); @@ -363,6 +363,12 @@ public class DungeonGenerator { case 13: temp = new Darkwizard(xPos, yPos, lvl); break; + case 14: + temp = new Darkswordsman(xPos, yPos, lvl); + break; + case 15: + temp = new Darkarcher(xPos, yPos, lvl); + break; default: temp = null; } diff --git a/core/src/com/dungeoncrawler/model/Item.java b/core/src/com/dungeoncrawler/model/Item.java index 409cdf6..44f250b 100644 --- a/core/src/com/dungeoncrawler/model/Item.java +++ b/core/src/com/dungeoncrawler/model/Item.java @@ -16,7 +16,7 @@ public abstract class Item { protected int lvl; protected int id; protected int extraHp; - protected int movementBoost; + protected float movementBoost; public Item(int lvl){ this.lvl = lvl; @@ -41,7 +41,7 @@ public abstract class Item { public int getExtraHp(){ return this.extraHp; } - public int getMovementBoost(){ + public float getMovementBoost(){ return this.movementBoost; } /** diff --git a/core/src/com/dungeoncrawler/model/entities/Darkarcher.java b/core/src/com/dungeoncrawler/model/entities/Darkarcher.java new file mode 100644 index 0000000..d003b37 --- /dev/null +++ b/core/src/com/dungeoncrawler/model/entities/Darkarcher.java @@ -0,0 +1,99 @@ +package com.dungeoncrawler.model.entities; + +import com.dungeoncrawler.StaticMath; +import com.dungeoncrawler.model.Entity; + +public class Darkarcher extends Entity{ + + int counter; + final int minRange; + final int maxRange; + final int attackSpeed; + + public Darkarcher(float xPos, float yPos, int lvl) { + super(xPos, yPos, lvl); + + this.maxhp = 100*lvl; + this.hp = this.maxhp; + this.direction = 1; + this.dmg = 7*lvl; + this.id = 27; + this.type = 1; + minRange = 80; + maxRange = 240; + attackSpeed = 100; + counter = 0; + // TODO: Sinnvolle Werte finden + + direction = 2; + + } + + @Override + public boolean move(int xPosPlayer, int yPosPlayer) { + if(!isToDelete()){ + + double alpha = StaticMath.calculateAngle((int) this.xPos, (int) this.yPos, xPosPlayer, yPosPlayer); + int distance = (int) StaticMath.calculateDistance((int) this.xPos, (int) this.yPos, xPosPlayer, yPosPlayer, alpha); + + if(distance >= minRange && distance <= maxRange && counter % attackSpeed == 0){ + return true; + } + else{ + movementX = (int) (4 * Math.cos(alpha)); + movementY = (int) (4 * Math.sin(alpha)); + + if(distance < minRange){ + movementX *= -1; + movementY *= -1; + } + else if(distance >= minRange && distance <= maxRange){ + movementX = 0; + movementY = 0; + } + + + xPos += movementX; + yPos += movementY; + } + + if(alpha >= Math.PI / -2 && alpha <= Math.PI / 2){ + setDirection(1); + } + else{ + setDirection(0); + } + + counter++; + } + + return false; + } + + @Override + public Entity shoot(int xPosPlayer, int yPosPlayer){ + Projectile a = null; + + if(!isToDelete()){ + double alpha = StaticMath.calculateAngle((int) this.xPos, (int) this.yPos, xPosPlayer, yPosPlayer); + + a = new Projectile(this.xPos + 32, this.yPos + 32, this.lvl,(int) this.dmg, 28, true); + int tempX = (int) (6 * Math.cos(alpha)); + int tempY = (int) (6 * Math.sin(alpha)); + + a.setMovementX(tempX); + a.setMovementY(tempY); + a.setAngle(alpha); + + if((alpha >= 0 && alpha <= Math.PI / 2) || (alpha <= 2 * Math.PI && alpha >= 2 * Math.PI - Math.PI / 2)){ + setDirection(1); + } + else{ + setDirection(0); + } + } + + return a; + } + +} diff --git a/core/src/com/dungeoncrawler/model/entities/Darkswordsman.java b/core/src/com/dungeoncrawler/model/entities/Darkswordsman.java new file mode 100644 index 0000000..9784a5b --- /dev/null +++ b/core/src/com/dungeoncrawler/model/entities/Darkswordsman.java @@ -0,0 +1,39 @@ +package com.dungeoncrawler.model.entities; + +import com.dungeoncrawler.StaticMath; +import com.dungeoncrawler.model.Entity; + +public class Darkswordsman extends Entity { + + public Darkswordsman(float xPos, float yPos, int lvl) { + super(xPos, yPos, lvl); + + this.maxhp = 120*lvl; + this.hp = this.maxhp; + this.direction = 1; + this.dmg = 12*lvl; + this.id = 26; + this.type = 0; + + // TODO: Sinnvolle Werte finden + direction = 2; + } + + @Override + public boolean move(int xPosPlayer, int yPosPlayer){ + if(!isToDelete()){ + double alpha = StaticMath.calculateAngle((int) this.xPos, (int) this.yPos, xPosPlayer, yPosPlayer); + + movementX = (int) (4 * Math.cos(alpha)); + movementY = (int) (4 * Math.sin(alpha)); + + xPos += movementX; + yPos += movementY; + + updateDirection(); + } + return false; + } + + +} diff --git a/core/src/com/dungeoncrawler/model/entities/Player.java b/core/src/com/dungeoncrawler/model/entities/Player.java index ab31d64..7ddb37a 100644 --- a/core/src/com/dungeoncrawler/model/entities/Player.java +++ b/core/src/com/dungeoncrawler/model/entities/Player.java @@ -20,8 +20,8 @@ public class Player extends Entity { int skin; String gender; - int standartMovementSpeed; - int movementSpeed; + float standartMovementSpeed; + float movementSpeed; public Player() { super(200, 200, 1); @@ -70,6 +70,9 @@ public class Player extends Entity { this.def = this.standartDef; this.maxhp = this.standartMaxHp; this.movementSpeed = this.standartMovementSpeed; + if(hp > maxhp){ + hp = maxhp; + } if(inv.getItem(0) != null && inv.getItem(1) == null){ this.dmg = this.standartDmg + inv.getItem(0).getDmg(); @@ -100,7 +103,7 @@ public class Player extends Entity { // nix lol weil key break; case 1: - if(hp == maxhp){ + if(hp >= maxhp){ } else{ @@ -174,7 +177,7 @@ public class Player extends Entity { public boolean inventoryFull(){ return inv.inventoryFull(); } - public int getMovementSpeed(){ + public float getMovementSpeed(){ return movementSpeed; } diff --git a/core/src/com/dungeoncrawler/model/items/DmgAmulet.java b/core/src/com/dungeoncrawler/model/items/DmgAmulet.java index 2170607..0e5c5aa 100644 --- a/core/src/com/dungeoncrawler/model/items/DmgAmulet.java +++ b/core/src/com/dungeoncrawler/model/items/DmgAmulet.java @@ -16,7 +16,7 @@ public class DmgAmulet extends Item { public DmgAmulet(int lvl) { super(lvl); this.dmg = 8 * lvl; - this.movementBoost = 1; + this.movementBoost = 0.5f; this.id = 3; } diff --git a/core/src/com/dungeoncrawler/view/GameScreen.java b/core/src/com/dungeoncrawler/view/GameScreen.java index 9230e12..5ad74e7 100644 --- a/core/src/com/dungeoncrawler/view/GameScreen.java +++ b/core/src/com/dungeoncrawler/view/GameScreen.java @@ -404,6 +404,18 @@ public class GameScreen { tx[0] = new Texture("sprites/spell/darkspell.png"); entitySprites[i] = new EntitySprite(tx, 16, 16); break; + case 26: + tx[0] = new Texture("sprites/swordsman/darkswordsman_"+gender+".png"); + entitySprites[i] = new EntitySprite(tx, 64, 64); + break; + case 27: + tx[0] = new Texture("sprites/archer/darkarcher_"+gender+".png"); + entitySprites[i] = new EntitySprite(tx, 64, 64); + break; + case 28: + tx[0] = new Texture("sprites/projectile/darkarrow.png"); + entitySprites[i] = new EntitySprite(tx, 24, 5); + break; } entitySprites[i].update((int) e.getxPos() + 32, (int) e.getyPos() + 32); diff --git a/core/src/com/dungeoncrawler/view/HudContainer.java b/core/src/com/dungeoncrawler/view/HudContainer.java index 476f5ec..9cb1012 100644 --- a/core/src/com/dungeoncrawler/view/HudContainer.java +++ b/core/src/com/dungeoncrawler/view/HudContainer.java @@ -128,6 +128,9 @@ public class HudContainer { if(n > 1){ n = 1; } + if(n <= 0){ + n = 0.01f; + } Texture playerHealthTexture = new Texture("sprites/playerHealthBar.png"); int newWidth = (int) (n * playerHealthTexture.getWidth()); TextureRegion[][] playerHealthRegion = TextureRegion.split(playerHealthTexture,newWidth, playerHealthTexture.getHeight()); @@ -166,11 +169,11 @@ public class HudContainer { break; case 2: selectedName = "Amulet "; - perk = "Damage: "; - selectedPerkValue = items[selected].getDmg(); + perk = "Defense: "; + selectedPerkValue = items[selected].getDef(); break; case 3: - selectedName = "Damage-Amulet "; + selectedName = "Amulet "; perk = "Damage: "; selectedPerkValue = items[selected].getDmg(); break;