I have gone back to enterFrame for now, I will use an update method when I have developed the skills and researched more in to enterFrames any why not to use them (multi threaded games).
Thank you for your input.
Question
public function Goblin()
{
move = true;
nTimer = 0;
speed = 1;
this.addEventListener(Event.ADDED_TO_STAGE, onAdd)
}
private function onAdd(e:Event):void
{
trace("added Goblin");
removeEventListener(Event.ADDED_TO_STAGE, onAdd);
}
public function goblinLoop()
{
trace("yes");
//trace(nTimer);
this.x -= 4;
}
This is the enemy class, and you can see I'm not using an enter frame to move it. Instead, from the main class I am...
private function updatePlayer():void
{
character.keyListner();
character.movementChar();
goblin1.goblinLoop();
goblin2.goblinLoop();
}
What I don't understand is that it traces "yes" in the output panel, but the goblin does not move, despite the function being called.
Solution
I have gone back to enterFrame for now, I will use an update method when I have developed the skills and researched more in to enterFrames any why not to use them (multi threaded games).
Thank you for your input.