Spider death animation+ tracking added
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package main.entities;
|
package main.entities;
|
||||||
|
|
||||||
|
import ea.Vektor;
|
||||||
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 {
|
||||||
|
|
||||||
@@ -16,6 +18,7 @@ public class Spider extends LivingEntity {
|
|||||||
spriteScale = 0.8f;
|
spriteScale = 0.8f;
|
||||||
posX = 4f;
|
posX = 4f;
|
||||||
posY = 4f;
|
posY = 4f;
|
||||||
|
mirrored = false;
|
||||||
|
|
||||||
actionFigur.neuerZustand(loader.getFigur(1), "lost_sight");
|
actionFigur.neuerZustand(loader.getFigur(1), "lost_sight");
|
||||||
actionFigur.neuerZustand(loader.getFigur(2), "walk");
|
actionFigur.neuerZustand(loader.getFigur(2), "walk");
|
||||||
@@ -28,11 +31,32 @@ public class Spider extends LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void update() {
|
protected void update() {
|
||||||
// Player player = Main.instance.getWorld().getCurrentMap().getPlayer();
|
Player player = Main.instance.getWorld().getCurrentMap().getPlayer();
|
||||||
|
if (!actionFigur.aktuellesVerhalten().equals(getDamageAnimationName())) {
|
||||||
|
if (lineOfSightClear(player)) {
|
||||||
|
if (dist(player) < 1f) {
|
||||||
|
zustandSetzen("attack");
|
||||||
|
} else {
|
||||||
|
Vektor toPlayer = vectorToEntity(player).normiert();
|
||||||
|
velX += toPlayer.x * accelleration;
|
||||||
|
velY += toPlayer.y * accelleration;
|
||||||
|
zustandSetzen("walk");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!actionFigur.aktuellesVerhalten().equals("idle")) {
|
||||||
|
zustandSetzen("lost_sight");
|
||||||
|
if (actionFigur.aktuelleFigur().aktuellesBild() == actionFigur.aktuelleFigur().animation().length - 1) {
|
||||||
|
zustandSetzen("idle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (actionFigur.aktuelleFigur().aktuellesBild() == actionFigur.aktuelleFigur().animation().length - 1) {
|
||||||
|
zustandSetzen("walk");
|
||||||
|
}
|
||||||
|
}
|
||||||
this.checkTileCollisions(Main.instance.getWorld().getCurrentMap());
|
this.checkTileCollisions(Main.instance.getWorld().getCurrentMap());
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class Item {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getIconPath(){
|
public String getIconPath(){
|
||||||
TODO:
|
// TODO:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user