How do i add health to enemies, make enemies come after you, and add health

Can you also say it like ur talking to a cat(for dummies)

1 Like

I could also use this information. I just want a simple enemy that is trying to run towards a player.

Hi @PandaWafer!

You can start with something like the way below and improve this code by yourself. (This code has to be in a script that is attached to your enemy entity).

var player = this.app.root.findByName("Player");
var distance = this.entity.getPosition().distance(player.getPosition());

if (distance > 1 && distance < 10) {
    // look at the player (probably your model need to be rotated 180 degrees)
    this.entity.lookAt(player.getPosition());
    // move forward (if the rigidbody is kinematic)
    this.entity.translateLocal(0,0,-0.1);
}
1 Like