diff --git a/core/assets/archer.png b/core/assets/archer.png index f1c0712..b35e6e9 100644 Binary files a/core/assets/archer.png and b/core/assets/archer.png differ diff --git a/core/assets/player.png b/core/assets/player.png new file mode 100644 index 0000000..1554e76 Binary files /dev/null and b/core/assets/player.png differ diff --git a/core/assets/swordsman.png b/core/assets/swordsman.png new file mode 100644 index 0000000..689fb68 Binary files /dev/null and b/core/assets/swordsman.png differ diff --git a/core/src/com/dungeoncrawler/control/Controller.java b/core/src/com/dungeoncrawler/control/Controller.java index 996549f..ed43d65 100644 --- a/core/src/com/dungeoncrawler/control/Controller.java +++ b/core/src/com/dungeoncrawler/control/Controller.java @@ -239,8 +239,14 @@ public class Controller extends ApplicationAdapter implements InputProcessor{ m = new GameScreen(d); Archer a = new Archer(0,0,0); newEntity(a,96,96,0); + Archer w = new Archer(0,0,0); + newEntity(w,96,144,0); Swordsman s = new Swordsman(0,0,0); newEntity(s,288,96,0); + Swordsman p = new Swordsman(0,0,0); + newEntity(p,288,144,0); + Swordsman q = new Swordsman(0,0,0); + newEntity(q,48,144,0); System.out.println("NICE"); } } diff --git a/core/src/com/dungeoncrawler/model/Entity.java b/core/src/com/dungeoncrawler/model/Entity.java index 8f00ef1..e753c0f 100644 --- a/core/src/com/dungeoncrawler/model/Entity.java +++ b/core/src/com/dungeoncrawler/model/Entity.java @@ -14,6 +14,7 @@ public abstract class Entity { protected float movementX; protected float movementY; protected int id; + protected int facing; @@ -23,6 +24,7 @@ public abstract class Entity { this.lvl = lvl; this.movementX = 0; this.movementY = 0; + this.facing = 2; @@ -139,6 +141,13 @@ public abstract class Entity { return this.id; } + public int getFacing(){ + return facing; + } + public void setFacing(int facing){ + this.facing = facing; + } + } \ No newline at end of file diff --git a/core/src/com/dungeoncrawler/model/entities/Archer.java b/core/src/com/dungeoncrawler/model/entities/Archer.java index 34683a3..155cd55 100644 --- a/core/src/com/dungeoncrawler/model/entities/Archer.java +++ b/core/src/com/dungeoncrawler/model/entities/Archer.java @@ -12,14 +12,13 @@ public class Archer extends Entity{ Timer tleft; int timerRuns; boolean isRunning; - int facing; public Archer(float xPos, float yPos, int lvl) { super(xPos, yPos, lvl); this.maxhp = 5*lvl; this.hp = this.maxhp; - + this.facing = 2; this.dmg = 3*lvl; this.id = 0; // TODO: Sinnvolle Werte finden @@ -40,17 +39,25 @@ public class Archer extends Entity{ if(i <= 0.2){ if(isRunning == false){ - tup.start(); + if(getyPos() == 240){ + } + else{ + tup.start(); + } } } else if(i > 0.2 && i <= 0.4){ if(isRunning == false){ - tright.start(); + if(getxPos() == 336){ + } + else{ + tright.start(); + } } } else if(i > 0.4 && i <= 0.6){ if(isRunning == false){ - if(getyPos() == 0){ + if(getyPos() == 48){ } else{ tdown.start(); @@ -59,7 +66,7 @@ public class Archer extends Entity{ } else if(i > 0.6 && i <= 0.8){ if(isRunning == false){ - if(getxPos() == 0){ + if(getxPos() == 48){ } else{ tleft.start(); @@ -85,7 +92,7 @@ public class Archer extends Entity{ tup.stop(); } } - },0,0.03f); + },0,0.02f); tup.stop(); tright.scheduleTask(new Timer.Task() { @Override @@ -100,7 +107,7 @@ public class Archer extends Entity{ tright.stop(); } } - },0,0.03f); + },0,0.02f); tright.stop(); tdown.scheduleTask(new Timer.Task() { @Override @@ -115,7 +122,7 @@ public class Archer extends Entity{ tdown.stop(); } } - },0,0.03f); + },0,0.02f); tdown.stop(); tleft.scheduleTask(new Timer.Task() { @Override @@ -131,7 +138,7 @@ public class Archer extends Entity{ tleft.stop(); } } - },0,0.03f); + },0,0.02f); tleft.stop(); t.start(); } @@ -151,12 +158,6 @@ public class Archer extends Entity{ timerRuns = n; } - public void setFacing(int i){ - facing = i; - } - public int getFacing(){ - return facing; - } } diff --git a/core/src/com/dungeoncrawler/model/entities/Swordsman.java b/core/src/com/dungeoncrawler/model/entities/Swordsman.java index 91ce978..a0f93be 100644 --- a/core/src/com/dungeoncrawler/model/entities/Swordsman.java +++ b/core/src/com/dungeoncrawler/model/entities/Swordsman.java @@ -11,14 +11,13 @@ public class Swordsman extends Entity { Timer tleft; int timerRuns; boolean isRunning; - int facing; public Swordsman(float xPos, float yPos, int lvl) { super(xPos, yPos, lvl); this.maxhp = 5*lvl; this.hp = this.maxhp; - + this.facing = 2; this.dmg = 3*lvl; this.id = 1; // TODO: Sinnvolle Werte finden @@ -38,17 +37,25 @@ public class Swordsman extends Entity { if(i <= 0.2){ if(isRunning == false){ - tup.start(); + if(getyPos() == 240){ + } + else{ + tup.start(); + } } } else if(i > 0.2 && i <= 0.4){ if(isRunning == false){ - tright.start(); + if(getxPos() == 336){ + } + else{ + tright.start(); + } } } else if(i > 0.4 && i <= 0.6){ if(isRunning == false){ - if(getyPos() == 0){ + if(getyPos() == 48){ } else{ tdown.start(); @@ -57,7 +64,7 @@ public class Swordsman extends Entity { } else if(i > 0.6 && i <= 0.8){ if(isRunning == false){ - if(getxPos() == 0){ + if(getxPos() == 48){ } else{ tleft.start(); @@ -65,7 +72,6 @@ public class Swordsman extends Entity { } } else{ - facing = 2; } } },0,1f); @@ -149,11 +155,5 @@ public class Swordsman extends Entity { timerRuns = n; } - public void setFacing(int i){ - facing = i; - } - public int getFacing(){ - return facing; - } } diff --git a/core/src/com/dungeoncrawler/view/GameScreen.java b/core/src/com/dungeoncrawler/view/GameScreen.java index 42c0527..a8c50c2 100644 --- a/core/src/com/dungeoncrawler/view/GameScreen.java +++ b/core/src/com/dungeoncrawler/view/GameScreen.java @@ -41,8 +41,8 @@ public class GameScreen { public GameScreen(Dungeon d) { //PLAYER - p = new Texture("Player.png"); - regions = TextureRegion.split(p, 64, 64); + p = new Texture("player.png"); + regions = TextureRegion.split(p, 48, 48); player = new Sprite(regions[0][2]); player.setX(200); player.setY(200); @@ -126,20 +126,40 @@ public class GameScreen { if(entitySprites[i] != null){ entitySprites[i].setX(e[i].getxPos()); entitySprites[i].setY(e[i].getyPos()); - switch(e[i].direction()){ + switch(e[i].getFacing()){ case -1: break; case 0: - entitySprites[i].setRegion(archerRegions[0][0]); + if(e[i].getId() == 0){ + entitySprites[i].setRegion(archerRegions[0][0]); + } + else if(e[i].getId() == 1){ + entitySprites[i].setRegion(swordsmanRegions[0][0]); + } break; case 1: - entitySprites[i].setRegion(archerRegions[0][1]); + if(e[i].getId() == 0){ + entitySprites[i].setRegion(archerRegions[0][1]); + } + else if(e[i].getId() == 1){ + entitySprites[i].setRegion(swordsmanRegions[0][1]); + } break; case 2: - entitySprites[i].setRegion(archerRegions[0][2]); + if(e[i].getId() == 0){ + entitySprites[i].setRegion(archerRegions[0][2]); + } + else if(e[i].getId() == 1){ + entitySprites[i].setRegion(swordsmanRegions[0][2]); + } break; case 3: - entitySprites[i].setRegion(archerRegions[0][3]); + if(e[i].getId() == 0){ + entitySprites[i].setRegion(archerRegions[0][3]); + } + else if(e[i].getId() == 1){ + entitySprites[i].setRegion(swordsmanRegions[0][3]); + } break; } @@ -158,22 +178,21 @@ public class GameScreen { public void newEntity(int i,Entity e, float x, float y){ - if(e.getId() == 0){ //nimmt entity ID -> 0 = Archer || 1 = Swordsman + if(e.getId() == 0){ //nimmt entity ID -> 0 = Archer || 1 = Swordsman || 2 = Arrow entityTextures[i] = new Texture("archer.png"); - archerRegions = TextureRegion.split(entityTextures[i], 64, 64); + archerRegions = TextureRegion.split(entityTextures[i], 48, 48); entitySprites[i] = new Sprite(archerRegions[0][2]); entitySprites[i].setX(x); entitySprites[i].setY(y); } - else if(e.getId() == 1){ - entityTextures[i] = new Texture("Swordsman.png"); - swordsmanRegions = TextureRegion.split(entityTextures[i], 64, 64); + if(e.getId() == 1){ + entityTextures[i] = new Texture("swordsman.png"); + swordsmanRegions = TextureRegion.split(entityTextures[i], 48, 48); entitySprites[i] = new Sprite(swordsmanRegions[0][2]); - entitySprites[i] = new Sprite(entityTextures[i]); entitySprites[i].setX(x); entitySprites[i].setY(y); } - else if(e.getId() == 2){ + if(e.getId() == 2){ arrowTextures[i] = new Texture("key.png"); arrowSprites[i] = new Sprite(arrowTextures[i]); arrowSprites[i].setX(x);