Merge branch 'master' of https://git.ngb.schule/Tim/Zoelda
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package main.entities;
|
||||
|
||||
import ea.Vektor;
|
||||
import main.Main;
|
||||
import main.SheetLoader;
|
||||
import main.entities.player.Player;
|
||||
|
||||
public class Spider extends LivingEntity {
|
||||
|
||||
@@ -16,6 +18,7 @@ public class Spider extends LivingEntity {
|
||||
spriteScale = 0.8f;
|
||||
posX = 4f;
|
||||
posY = 4f;
|
||||
mirrored = true;
|
||||
|
||||
actionFigur.neuerZustand(loader.getFigur(1), "lost_sight");
|
||||
actionFigur.neuerZustand(loader.getFigur(2), "walk");
|
||||
@@ -28,11 +31,32 @@ public class Spider extends LivingEntity {
|
||||
}
|
||||
|
||||
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());
|
||||
super.update();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ public class Item {
|
||||
* @return
|
||||
*/
|
||||
public String getIconPath(){
|
||||
TODO:
|
||||
// TODO:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user