I’ve been trying to make a really simple enemy by following tutorials and trying to get it to work for what I’m doing, but I’m having a hard time, just because I don’t know where to start.
I basically want to make an enemy that does this:
- chases the player when the player gets too close
- causes damage when colliding with the player (I can do this part of the code myself)
- stops chase once the player outruns the enemy and gets a certain distance away.
If anyone can help me understand how to make these enemies, or lay down some code for me, that would be great.
If you need the player script, here’s a portion of it that would be most relevant.
PlayerStatus.js
var health : float;
var points : float;
function Update () {
}
function ApplyDamage (totalDamage : int) {
health -= totalDamage;
if (health <= 0) {
Kill ();
}
}
function Kill () {
print("YOU ARE DEAD");
}