diff --git a/Info/Info 1 - Nr1.pdf b/Info/Info 1 - Nr1.pdf new file mode 100644 index 0000000..60ab84e Binary files /dev/null and b/Info/Info 1 - Nr1.pdf differ diff --git a/Info/Info 1 - Nr2.pdf b/Info/Info 1 - Nr2.pdf new file mode 100644 index 0000000..2d08da8 Binary files /dev/null and b/Info/Info 1 - Nr2.pdf differ diff --git a/Info/Info 1 - Nr3.pdf b/Info/Info 1 - Nr3.pdf new file mode 100644 index 0000000..f4ff296 Binary files /dev/null and b/Info/Info 1 - Nr3.pdf differ diff --git a/Info/Info 1 - Nr4.pdf b/Info/Info 1 - Nr4.pdf new file mode 100644 index 0000000..bc4ea89 Binary files /dev/null and b/Info/Info 1 - Nr4.pdf differ diff --git a/Info/Info 2 - Nr1.pdf b/Info/Info 2 - Nr1.pdf new file mode 100644 index 0000000..897d284 Binary files /dev/null and b/Info/Info 2 - Nr1.pdf differ diff --git a/Info/Info 2 - Nr2.pdf b/Info/Info 2 - Nr2.pdf new file mode 100644 index 0000000..c6485ab Binary files /dev/null and b/Info/Info 2 - Nr2.pdf differ diff --git a/Info/Pflichten + Lastenheft.pdf b/Info/Pflichten + Lastenheft.pdf new file mode 100644 index 0000000..c6485ab Binary files /dev/null and b/Info/Pflichten + Lastenheft.pdf differ diff --git a/Zwischenstand_15.4.20.jar b/Zwischenstand_15.4.20.jar new file mode 100644 index 0000000..8f775b1 Binary files /dev/null and b/Zwischenstand_15.4.20.jar differ diff --git a/core/assets/healingPotion.png b/core/assets/healingPotion.png new file mode 100644 index 0000000..de1c734 Binary files /dev/null and b/core/assets/healingPotion.png differ diff --git a/core/assets/hud.png b/core/assets/hud.png new file mode 100644 index 0000000..c552bcd Binary files /dev/null and b/core/assets/hud.png differ diff --git a/core/assets/sword.png b/core/assets/sword.png new file mode 100644 index 0000000..7334289 Binary files /dev/null and b/core/assets/sword.png differ diff --git a/core/src/com/dungeoncrawler/control/Controller.java b/core/src/com/dungeoncrawler/control/Controller.java index 3e6965f..b8af3d7 100644 --- a/core/src/com/dungeoncrawler/control/Controller.java +++ b/core/src/com/dungeoncrawler/control/Controller.java @@ -45,7 +45,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ Sprite verticalAttackSprite; Sprite horizontalAttackSprite; - + Timer entityMovement; @Override public void create(){ @@ -96,7 +96,18 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ Gdx.input.setInputProcessor(this); + entityMovement = new Timer(); + entityMovement.scheduleTask(new Timer.Task() { + @Override + public void run() { + for(int i = 0; i <= 4; i++){ + if(e[i] != null){ + e[i].randomMove(roomX, roomY); + } + } + } + },0,1f); } @@ -225,13 +236,11 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ switch(ent.getId()){ case 0: e[i] = new Archer(x,y,lvl); - e[i].startT(); m.newEntity(i,ent,x,y); i = 11; break; case 1: e[i] = new Swordsman(x,y,lvl); - e[i].startT(); m.newEntity(i,ent,x,y); i = 11; break; @@ -297,7 +306,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ if(keycode == Input.Keys.E){ if(v != null){} if(m != null){ - m.PlayerAttack(e, d.getPlayer()); + m.playerAttack(e, d.getPlayer()); } } return true; @@ -383,6 +392,10 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ return false; } + public Entity[] getEntities(){ + return e; + } + diff --git a/core/src/com/dungeoncrawler/model/Entity.java b/core/src/com/dungeoncrawler/model/Entity.java index 5d9884f..f0b5434 100644 --- a/core/src/com/dungeoncrawler/model/Entity.java +++ b/core/src/com/dungeoncrawler/model/Entity.java @@ -157,7 +157,7 @@ public abstract class Entity { public void setFacing(int facing){ this.facing = facing; } - public void startT(){ + public void randomMove(int x, int y){ } diff --git a/core/src/com/dungeoncrawler/model/Inventory.java b/core/src/com/dungeoncrawler/model/Inventory.java index 15a9362..8b2e88f 100644 --- a/core/src/com/dungeoncrawler/model/Inventory.java +++ b/core/src/com/dungeoncrawler/model/Inventory.java @@ -4,10 +4,11 @@ package com.dungeoncrawler.model; public class Inventory { Item items[][]; - Item equip; + Item equipped[]; Inventory(int width, int height){ items = new Item[width][height]; + equipped = new Item[2]; } public void addItem(Item i) @@ -25,9 +26,12 @@ public class Inventory { } public void equipItem(int x, int y){ - if(equip == null){ - equip = items[x][y]; - dropItem(x,y); + if(items[x][y] == null || items[x][y].getId() == 0){} + else{ + int slot = items[x][y].getId() - 1; + Item temp = equipped[slot]; + equipped[slot] = items[x][y]; + items[x][y] = temp; } } diff --git a/core/src/com/dungeoncrawler/model/Item.java b/core/src/com/dungeoncrawler/model/Item.java index 9777aa1..7ab6858 100644 --- a/core/src/com/dungeoncrawler/model/Item.java +++ b/core/src/com/dungeoncrawler/model/Item.java @@ -10,25 +10,23 @@ package com.dungeoncrawler.model; * @author jonathan */ public abstract class Item { - private int amount; + protected int dmg; + protected int heal; + protected int lvl; + protected int id; - public Item(int amount){ - this.amount = amount; + public Item(int lvl){ + this.lvl = lvl; } - /** - * @return the amount - */ - public int getAmount() { - return amount; + + public int getId(){ + return this.id; } - /** - * @param amount the amount to set + * @return the amount */ - public void setAmount(int amount) { - this.amount = amount; - } + } diff --git a/core/src/com/dungeoncrawler/model/entities/Archer.java b/core/src/com/dungeoncrawler/model/entities/Archer.java index 1f0636a..32490df 100644 --- a/core/src/com/dungeoncrawler/model/entities/Archer.java +++ b/core/src/com/dungeoncrawler/model/entities/Archer.java @@ -5,7 +5,6 @@ import com.badlogic.gdx.utils.Timer; public class Archer extends Entity{ - Timer t; Timer tup; Timer tright; Timer tdown; @@ -31,59 +30,10 @@ public class Archer extends Entity{ timerRuns = 0; facing = 2; - t = new Timer(); - t.scheduleTask(new Timer.Task() { - @Override - public void run() { - double i = Math.random(); - - if(i <= 0.2){ - if(isRunning == false){ - if(getyPos() == 240){ - } - else{ - tup.start(); - } - } - } - else if(i > 0.2 && i <= 0.4){ - if(isRunning == false){ - if(getxPos() == 336){ - } - else{ - tright.start(); - } - } - } - else if(i > 0.4 && i <= 0.6){ - if(isRunning == false){ - if(getyPos() == 48){ - } - else{ - tdown.start(); - } - } - } - else if(i > 0.6 && i <= 0.8){ - if(isRunning == false){ - if(getxPos() == 48){ - } - else{ - tleft.start(); - } - } - } - else{ - //facing = 2; - } - } - },0,1f); - t.stop(); tup.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(0); - setIsRunning(true); setyPos(getyPos() + 1f); setTimerRuns(getTimerRuns() + 1); if(getTimerRuns() >= 48){ @@ -92,13 +42,12 @@ public class Archer extends Entity{ tup.stop(); } } - },0,0.02f); + },0,0.015f); tup.stop(); tright.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(1); - setIsRunning(true); setxPos(getxPos() + 1f); setTimerRuns(getTimerRuns() + 1); if(getTimerRuns() >= 48){ @@ -107,13 +56,12 @@ public class Archer extends Entity{ tright.stop(); } } - },0,0.02f); + },0,0.015f); tright.stop(); tdown.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(2); - setIsRunning(true); setyPos(getyPos() - 1f); setTimerRuns(getTimerRuns() + 1); if(getTimerRuns() >= 48){ @@ -122,13 +70,12 @@ public class Archer extends Entity{ tdown.stop(); } } - },0,0.02f); + },0,0.015f); tdown.stop(); tleft.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(3); - setIsRunning(true); setxPos(getxPos() - 1f); setTimerRuns(getTimerRuns() + 1); @@ -138,11 +85,59 @@ public class Archer extends Entity{ tleft.stop(); } } - },0,0.02f); + },0,0.015f); tleft.stop(); } + @Override + public void randomMove(int x, int y) { + double i = Math.random(); + if(i <= 0.2){ + if(isRunning == false){ + if(getyPos() >= (x-1) * 48f){ + } + else{ + setIsRunning(true); + tup.start(); + } + } + } + else if(i > 0.2 && i <= 0.4){ + if(isRunning == false){ + if(getxPos() >= (y-1) * 48f){ + } + else{ + setIsRunning(true); + tright.start(); + } + } + } + else if(i > 0.4 && i <= 0.6){ + if(isRunning == false){ + if(getyPos() <= 48f){ + } + else{ + setIsRunning(true); + tdown.start(); + } + } + } + else if(i > 0.6 && i <= 0.8){ + if(isRunning == false){ + if(getxPos() <= 48f){ + } + else{ + setIsRunning(true); + tleft.start(); + } + } + } + else{ + } + } + + private void setIsRunning(boolean n){ isRunning = n; } @@ -157,10 +152,7 @@ public class Archer extends Entity{ public void setTimerRuns(int n){ timerRuns = n; } - @Override - public void startT(){ - t.start(); - } + } diff --git a/core/src/com/dungeoncrawler/model/entities/Swordsman.java b/core/src/com/dungeoncrawler/model/entities/Swordsman.java index d7ef489..4eaf03a 100644 --- a/core/src/com/dungeoncrawler/model/entities/Swordsman.java +++ b/core/src/com/dungeoncrawler/model/entities/Swordsman.java @@ -4,7 +4,6 @@ import com.dungeoncrawler.model.Entity; public class Swordsman extends Entity { - Timer t; Timer tup; Timer tright; Timer tdown; @@ -29,58 +28,11 @@ public class Swordsman extends Entity { timerRuns = 0; facing = 2; - t = new Timer(); - t.scheduleTask(new Timer.Task() { - @Override - public void run() { - double i = Math.random(); - if(i <= 0.2){ - if(isRunning == false){ - if(getyPos() == 240){ - } - else{ - tup.start(); - } - } - } - else if(i > 0.2 && i <= 0.4){ - if(isRunning == false){ - if(getxPos() == 336){ - } - else{ - tright.start(); - } - } - } - else if(i > 0.4 && i <= 0.6){ - if(isRunning == false){ - if(getyPos() == 48){ - } - else{ - tdown.start(); - } - } - } - else if(i > 0.6 && i <= 0.8){ - if(isRunning == false){ - if(getxPos() == 48){ - } - else{ - tleft.start(); - } - } - } - else{ - } - } - },0,1f); - t.stop(); tup.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(0); - setIsRunning(true); setyPos(getyPos() + 1f); setTimerRuns(getTimerRuns() + 1); if(getTimerRuns() >= 48){ @@ -89,13 +41,12 @@ public class Swordsman extends Entity { tup.stop(); } } - },0,0.03f); + },0,0.025f); tup.stop(); tright.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(1); - setIsRunning(true); setxPos(getxPos() + 1f); setTimerRuns(getTimerRuns() + 1); if(getTimerRuns() >= 48){ @@ -104,13 +55,12 @@ public class Swordsman extends Entity { tright.stop(); } } - },0,0.03f); + },0,0.025f); tright.stop(); tdown.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(2); - setIsRunning(true); setyPos(getyPos() - 1f); setTimerRuns(getTimerRuns() + 1); if(getTimerRuns() >= 48){ @@ -119,13 +69,12 @@ public class Swordsman extends Entity { tdown.stop(); } } - },0,0.03f); + },0,0.025f); tdown.stop(); tleft.scheduleTask(new Timer.Task() { @Override public void run() { setFacing(3); - setIsRunning(true); setxPos(getxPos() - 1f); setTimerRuns(getTimerRuns() + 1); @@ -135,10 +84,55 @@ public class Swordsman extends Entity { tleft.stop(); } } - },0,0.03f); + },0,0.025f); tleft.stop(); } + @Override + public void randomMove(int x, int y) { + double i = Math.random(); + if(i <= 0.25){ + if(isRunning == false){ + if(yPos >= (x-1) * 48f){ + } + else{ + setIsRunning(true); + tup.start(); + } + } + } + else if(i > 0.25 && i <= 0.5){ + if(isRunning == false){ + if(xPos >= (y-1) * 48f){ + } + else{ + setIsRunning(true); + tright.start(); + } + } + } + else if(i > 0.5 && i <= 0.75){ + if(isRunning == false){ + if(yPos <= 48f){ + } + else{ + setIsRunning(true); + tdown.start(); + } + } + } + else if(i > 0.75 && i <= 1){ + if(isRunning == false){ + if(xPos <= 48f){ + } + else{ + setIsRunning(true); + tleft.start(); + } + } + } + } + private void setIsRunning(boolean n){ isRunning = n; } @@ -153,9 +147,6 @@ public class Swordsman extends Entity { public void setTimerRuns(int n){ timerRuns = n; } - @Override - public void startT(){ - t.start(); - } + } diff --git a/core/src/com/dungeoncrawler/model/items/Key.java b/core/src/com/dungeoncrawler/model/items/Key.java index cd2e88f..a99d3a0 100644 --- a/core/src/com/dungeoncrawler/model/items/Key.java +++ b/core/src/com/dungeoncrawler/model/items/Key.java @@ -13,8 +13,9 @@ import com.dungeoncrawler.model.Item; */ public class Key extends Item { - public Key(int amount) { - super(amount); + public Key(int lvl) { + super(lvl); + this.id = 0; } } diff --git a/core/src/com/dungeoncrawler/model/items/Potion.java b/core/src/com/dungeoncrawler/model/items/Potion.java index 164a5d4..f715895 100644 --- a/core/src/com/dungeoncrawler/model/items/Potion.java +++ b/core/src/com/dungeoncrawler/model/items/Potion.java @@ -13,8 +13,10 @@ import com.dungeoncrawler.model.Item; */ public class Potion extends Item { - public Potion(int amount) { - super(amount); + public Potion(int lvl) { + super(lvl); + this.heal = lvl * 3; + this.id = 1; } } diff --git a/core/src/com/dungeoncrawler/model/items/Sword.java b/core/src/com/dungeoncrawler/model/items/Sword.java index fe17918..c9135eb 100644 --- a/core/src/com/dungeoncrawler/model/items/Sword.java +++ b/core/src/com/dungeoncrawler/model/items/Sword.java @@ -13,8 +13,9 @@ import com.dungeoncrawler.model.Item; */ public class Sword extends Item { - public Sword(int amount) { - super(amount); + public Sword(int lvl) { + super(lvl); + this.dmg = lvl * 4; } } diff --git a/core/src/com/dungeoncrawler/view/GameScreen.java b/core/src/com/dungeoncrawler/view/GameScreen.java index c2a5736..546c375 100644 --- a/core/src/com/dungeoncrawler/view/GameScreen.java +++ b/core/src/com/dungeoncrawler/view/GameScreen.java @@ -219,7 +219,7 @@ public class GameScreen { } } - public void PlayerAttack(Entity e[], Player p){ + public void playerAttack(Entity e[], Player p){ if(p.direction() == 0){ Texture verticalAttack = new Texture("AttackHori.png"); Sprite verticalAttackSprite = new Sprite(verticalAttack);