Game Development Community

How to give an item/object a behavior (newbie question)

by Paul Sisneros · in Technical Issues · 02/04/2007 (9:51 am) · 2 replies

So, i understand how to create things and give them their prescripted behaviors like rotating, But how do i make something follow a new behavior? I cant just put a loop in a data block obviously. So if i want to make a function (or something like it if theres another thing i should use for this) and have all instances of a item/object follow it without messing with eachother varaibles how is that done? I figure it must be fairly routine since all games need to do it, but i cant figure out how. Im thinking i need to call some function when its created and have that function call itself, but Im not sure how to handle the variables so that multiple instances could use it.

lets say i make an item and for example purposes it does something simple like sliding around and changing its direction randomly every few seconds, and i want to be able to make as many of these as I like. How do I do it?

#1
02/06/2007 (10:01 am)
You can make a function to do that, or you can place your objects by hand. Theres many ways it could be done. Also to answer you other question about variables and scope: tdn.garagegames.com/wiki/TorqueScript#Variables

tdn.garagegames.com/wiki/TorqueScript
#2
02/06/2007 (2:58 pm)
Thanks, i seem to have it figured out now