Game Development Community

Path buidling and editing

by rennie moffat · in Torque Game Builder · 10/02/2009 (6:49 pm) · 2 replies

Hi there,
I have been studying and working with paths for most of the day. I built my own pathA1 file, i used a bunch of code then realized this was probably just as good as it seems to use everything.

function enemyPlanePath::onAddToScene(%this, %scenegraph)
{
    %this = pathA1;
	
	%this.attachObject([%object = enemyPlane], [%speed = 10], [%direction = -1], [%startNode = -1], [%endNode = 1], [%followMode = "WRAP"], [%loops = 0], [%sendToStart = false]);

}


so this, despite classing it and naming it, downs not seem to work. A quick question is, would/should ( i ask this as general practice, because I have seen different methods) a safe/solid way to script a path?






However, beyond that, I began to use this code, it is the attachPath.cs file found in TGB behaviors. It had worked once last night, but as I used it today it did not. There should be nothing wrong or complex here right? just choose your path and separate variables but my object, which I attached the behavior to, does not look up with the path I have named. I have looked at the forums and all the methods and call backs, I was just wondering if anyone had some good practice suggestions, tips, or noting of something that I am doing blatantly wrong.


Thanks!

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
10/02/2009 (11:33 pm)
You should never re-assign the local "this" variable as the caller has already set this.

In addition, the parameters you are using cannot be used in that manner, as mentioned in one of your previous posts www.garagegames.com/community/forums/viewthread/101395/1#comment-674381.

To answer your question, yes, there is nothing complex here.
#2
10/03/2009 (6:27 am)
right so I can not claim %this as something then within the same function say %this = blah as well. In other words %this, with in the same function, can not be two things. Makes sense and I was thinking about that. Thanks William.