Game Development Community

Shoots behavior, how to define projectile

by Syruhaus · in Torque Game Builder · 08/16/2007 (4:54 pm) · 7 replies

Hi,
I just added a "Shoots" behavior to my player but I can't seem to select any projectiles. All I can select from the drop down is "None".

The behaviorField in the .cs file looks like this:
%template.addBehaviorField(projectile, "The projectile to clone and shoot", object, "", t2dSceneObject);

I have my bullet/projectile loaded as a static sprite, how do I select in the Shoots behavior?

Please help

#1
08/18/2007 (8:53 am)
Anyone... Please help.
#2
08/20/2007 (9:42 am)
Any object in your current scene should show up, I dunno what to tell you.
#3
08/20/2007 (10:57 am)
Have you tried this? I'm using v1.5.1 of TGB
#4
08/20/2007 (12:38 pm)
You have to name your object before it will appear in the drop down.
#5
08/20/2007 (1:39 pm)
Thanks a lot! It works now!
#6
07/17/2009 (9:30 am)
HI,
I am doing the same thing and can't get my "shoots" behaviour to recognize it's projectile.


My code is as follows, but what I am wondering is where do I "name" the projectile as mentioned above? Do I need to edit code accordingly?



if (!isObject(ShootsBehavior))
{
%template = new BehaviorTemplate(ShootsBehavior);

%template.friendlyName = "Shoots";
%template.behaviorType = "Input";
%template.description = "Shoots an object";

%template.addBehaviorField(projectile, "The projectile to clone and shoot", object, "", t2dSceneObject);
%template.addBehaviorField(fireKey, "The key to fire the projectile with", keybind, "keyboard space");
%template.addBehaviorField(fireRate, "The rate to fire when the fire key is held down (seconds)", float, "0.25");
%template.addBehaviorField(projectileSpeed, "The speed of projectiles (world units per second)", float, "150");
}

function ShootsBehavior::onBehaviorAdd(%this)
#7
07/17/2009 (9:45 am)
please ignore, i just found it.

thanks.