T2dPath help
by Wil Klentzeris · in Torque Game Builder · 09/14/2006 (9:32 pm) · 2 replies
I am trying to implement t2dPath and am having some problems.
here is an example of what I am doing:
function player::onLevelLoaded(%this, %scenegraph)
{
%this.schedule(3000, "newPath");
}
function player::newPath(%this)
{
%newPath = new t2dPath();
%newPath.addNode("0 0", 0);
%newPath.addNode("-25 0", 1);
%newPath.addNode("-50 0", 2);
%newPath.addNode("-75 0", 3);
%newPath.setPathType("LINEAR");
%newPath.attachObject(%this, 5, 1, 0, 3, "WRAP", 3, false);
%newPath.setMoveForward(%this, true);
}
The sprite moves to the first node and then stops.
Any suggestions?
here is an example of what I am doing:
function player::onLevelLoaded(%this, %scenegraph)
{
%this.schedule(3000, "newPath");
}
function player::newPath(%this)
{
%newPath = new t2dPath();
%newPath.addNode("0 0", 0);
%newPath.addNode("-25 0", 1);
%newPath.addNode("-50 0", 2);
%newPath.addNode("-75 0", 3);
%newPath.setPathType("LINEAR");
%newPath.attachObject(%this, 5, 1, 0, 3, "WRAP", 3, false);
%newPath.setMoveForward(%this, true);
}
The sprite moves to the first node and then stops.
Any suggestions?
About the author
#2
Thanks. Can't believe I missed that.
The documentation seemed easier to follow before with the minor examples.
Here is the updated script that now works:
-----------------------------------------------------------------------------------
function player::onLevelLoaded(%this, %scenegraph)
{
%this.schedule(3000, "newPath");
}
function player::newPath(%this)
{
%newPath = new t2dPath() { scenegraph = %this.scenegraph; };
%newPath.addNode("0 0", 0);
%newPath.addNode("-25 0", 1);
%newPath.addNode("-50 0", 2);
%newPath.addNode("-75 0", 3);
%newPath.setPathType("LINEAR");
%newPath.attachObject(%this, 5, 1, 0, 3, "WRAP", 3, false);
}
09/15/2006 (6:51 am)
Igor,Thanks. Can't believe I missed that.
The documentation seemed easier to follow before with the minor examples.
Here is the updated script that now works:
-----------------------------------------------------------------------------------
function player::onLevelLoaded(%this, %scenegraph)
{
%this.schedule(3000, "newPath");
}
function player::newPath(%this)
{
%newPath = new t2dPath() { scenegraph = %this.scenegraph; };
%newPath.addNode("0 0", 0);
%newPath.addNode("-25 0", 1);
%newPath.addNode("-50 0", 2);
%newPath.addNode("-75 0", 3);
%newPath.setPathType("LINEAR");
%newPath.attachObject(%this, 5, 1, 0, 3, "WRAP", 3, false);
}
Torque Owner Igor Kuryatnikov