Spider added

This commit is contained in:
04Mlg04
2021-06-25 20:27:03 +02:00
parent 1bb7c7ca7a
commit 6a100c8b88
2 changed files with 17 additions and 11 deletions

View File

@@ -2,14 +2,14 @@ package main.entities;
import main.Main; import main.Main;
import main.SheetLoader; import main.SheetLoader;
import main.entities.player.Player;
public class Spider extends LivingEntity { public class Spider extends LivingEntity {
private static SheetLoader loader = new SheetLoader("/res/images/spider_sprite_sheet.png", 32, 32, private static SheetLoader loader = new SheetLoader("/res/images/spider_sprite_sheet.png", 32, 32, new int[] { 5, 3, 6, 9, 9, 8 });
new int[] { 5, 6, 9, 1, 4, 3, 9, 6, 5, 6, 9, 1, 4, 3, 9, 6 });
public Spider() { public Spider() {
super(loader.getFigur(0), "walk"); super(loader.getFigur(0), "idle");
width = 0.7f; width = 0.7f;
height = 0.8f; height = 0.8f;
@@ -17,27 +17,33 @@ public class Spider extends LivingEntity {
spriteScale = 0.8f; spriteScale = 0.8f;
posX = 4f; posX = 4f;
posY = 4f; posY = 4f;
actionFigur.neuerZustand(loader.getFigur(1), "lost_sight");
actionFigur.neuerZustand(loader.getFigur(2), "walk");
actionFigur.neuerZustand(loader.getFigur(3), "attack");
actionFigur.neuerZustand(loader.getFigur(4), getDeathAnimationName());
actionFigur.neuerZustand(loader.getFigur(5), getDamageAnimationName());
loader.getFigur(3).animationsGeschwindigkeitSetzen(80);
loader.getFigur(5).animationsGeschwindigkeitSetzen(40);
} }
protected void update() { protected void update() {
Player player = Main.instance.getWorld().getCurrentMap().getPlayer();
// auf Kollisionen prüfen this.checkTileCollisions(Main.instance.getWorld().getCurrentMap());
checkTileCollisions(Main.instance.getWorld().getCurrentMap());
// LivingEntity auch updaten lassen
super.update(); super.update();
velX = 0;
velY = 0;
} }
@Override @Override
public String getDeathAnimationName() { public String getDeathAnimationName() {
return null; return "die";
} }
@Override @Override
public String getDamageAnimationName() { public String getDamageAnimationName() {
return null; return "damage";
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB