Game Development Community

T2D Tutorial moveTo - Creating a moveTo Function

About the author

Was a GG Associate and then joined GG in 2005. Lead tool dev for T2D and T3D. In 2011 joined mobile company ngmoco/DeNA and spent about 4 years working game and server tech. 2014 joined startup Merigo Games developing server technology.


#1
04/10/2005 (11:16 pm)
You're a frigging monster. @_@ Nice job, and great tutorials all round so far. :)
#2
04/29/2005 (10:13 pm)
Thanks a lot for this tutorial. I'm going through this though, and see a possible problem for readers. There's a section near the beginning that says this:

Quote:Ok now everything should work fine, we got a box in the middle of the screen...

lets start with our first function

function fxSceneObject2D::setDestination(%this, %dest)
{

}
we'll attach it to fxSceneObject2D so all objects inherit this... so later we can simply do $player.moveToDestination();

since its in a namespace "::"... %this will automatically be the object thats calling this function and %dest will be what we pass... like this

$player.setDestination("5 5");

... ok lets add the inner workings of it

However, it's not clear which cs file you want the reader to add this to. You had the reader create 2 files, and edit the client.cs. I'm guessing it's to go into the moveTo.cs, but you should clarify that the reader should open that file before adding code.

Anyway, just thought I'd let you know. I'll continue through this now :). Thanks again!
#3
04/29/2005 (10:44 pm)
Sorry about that, definatly like it when people point these things out :) I usually go through these pretty quick and in spurts, though I recreate them as I go through so they should work...

that one should be added to the moveTo.cs ... though in all honesty it would work wherever you add it :) as long as you don't call it before you create it

good point though, usually I try to be very defined at first, then slowly wing away from describing every detail throughout the tutorial.
#4
04/29/2005 (10:47 pm)
Btw the path point system is a great one to go to after this :)
#5
04/29/2005 (11:04 pm)
Yeah! That's why I'm doing this in the first place, because I'm definitely interested in using that path point system in my game. This is really great. This is actually something that gave me worry at first, before you made these tutorials.
#6
04/30/2005 (12:31 am)
I have a question.

if((%dest != 0) && (%dest !$= ""))
Why isn't the first "!=" like the second "!$="? In the tutorial it says,
Quote:this ensures the destination we pass isnt equal to 0 or an empty string
This makes me think the two set of symbols should have the same meaning. They have different meanings? Don't they both mean "not equal to"? Or just the second one? Thanks.
#7
04/30/2005 (12:53 am)
The first one is not equal to the number 0. The second is not equal to a null string value.

When you compare numbers you can just use = or !=. If you want to compare strings you need $= or !$=
#8
04/30/2005 (12:59 am)
Thank you much!