Game Development Community

moveTo() command broken ?? (Solved)

by Jack-S- · in iTorque 2D · 10/09/2011 (12:16 pm) · 2 replies

Hi ive been trying to use the moveTo command however it seems it might be broken.
I have tried both the move toward behavior and my own code but none work...
my own code.

function enemyObject::onAddToScene(%this)
{
enemyObject.enableUpdateCallback();

function enemyObject::onUpdate(%this)
{
echo("enemyObject onUpdate has been called");
%enemySpeed = 150.0;
enemyObject.moveTo(playerShip.getPostion(),%enemySpeed, true, true, true, 0.1);
}
I have used both playerShip.position and just playerShip aswell as the above but my object doest want to move...
all physics, collision and callback have been enabled so im wondering if its no longer working if not how would I get an object to move toward my player without this command. I am aware of setPosition() but this is more like teleportation...

#1
10/09/2011 (3:52 pm)
Jack, change enemyObject.moveTo to %this.moveTo
#2
10/13/2011 (6:59 am)
@Scott - Thanks! its working now.