HTML Code:
function onCreated()
{
this.showCharacter();
this.curPlayer = findPlayer("cHANDLER");
this.onTimeout();
}
function onTimeout()
{
temp.movex = this.curPlayer.x - x; // x needed to travel to player
temp.movey = this.curPlayer.y - y; // y needed to travel to player
dir = getdir(temp.movex, temp.movey);
if (player.dir == 1) { this.desx = 1.7; this.desy = 1; }
if (player.dir == 0) { this.desx = -1.7; this.desy = 1; }
if (player.dir == 2) { this.desx = 1.7; this.desy = -1.7; }
if (player.dir == 3) { this.desx = -1.7; this.desy = -1.7; }
this.ani = "walk";
move((temp.movex + this.desx), (temp.movey + this.desy), 1, 1);
}
function onMovementFinished()
{
this.ani = "idle";
this.onTimeout();
}
Mainly, you should focus on the "onMovementFinished()" function.
That's how I was testing it, however it wasn't finishing the movement. (Wasn't calling "onMovementFinished()")