Dynamic behavior creation
by Austin Reynolds · in Torque Game Builder · 10/05/2008 (11:54 am) · 4 replies
Does anyone know of a tutorial / resource or can show me how to do the following.
Here is what I have
new t2dStaticSprite() {
scenegraph = $sceneGraph;
class = rPlayer;
name = "joe";
Layer=1;
imageMap = eelsheetImageMap;
size = "5.00 3.00";
position = "1.00 1.00";
};
Which works great.
The problem is I need to add a behavior to the object. I have searched all over the forums on adding behaviors and dynamic behaviors but nothing that I can find shows how to either add the behavior(with attributes) into lets say a data block or to the object after its created.
Any help would be awesome!
Thanks for all those that have helped befor.
Here is what I have
new t2dStaticSprite() {
scenegraph = $sceneGraph;
class = rPlayer;
name = "joe";
Layer=1;
imageMap = eelsheetImageMap;
size = "5.00 3.00";
position = "1.00 1.00";
};
Which works great.
The problem is I need to add a behavior to the object. I have searched all over the forums on adding behaviors and dynamic behaviors but nothing that I can find shows how to either add the behavior(with attributes) into lets say a data block or to the object after its created.
Any help would be awesome!
Thanks for all those that have helped befor.
About the author
#2
new t2dStaticSprite() {
or inside a data block.
10/05/2008 (1:59 pm)
So just to make sure( I am going to try it here in a bit getting ready to take off) but I put that inside the new t2dStaticSprite() {
or inside a data block.
#3
Another way is to do this.
10/05/2008 (2:17 pm)
Yeah inside the braces, look at your .t2d level file and find an object that you added a behavior too via the editor. It looks just like he posted.Another way is to do this.
%obj = new t2dStaticSprite()
{
...
};
%beh = BehaviorTemplatename.createInstance();
%beh.fields = what you want;
...
%obj.addBehavior( %beh );
#4
I think im on your favorite list....Or your a stalker ;)
10/05/2008 (2:19 pm)
Ok Ill give that a try, thanks alotI think im on your favorite list....Or your a stalker ;)
Torque Owner Shaderman
Everything between the quotes needs to be TAB separated.