Apply Behavior to spawned object
by Mathieu · in Torque Game Builder · 10/22/2007 (11:16 am) · 2 replies
How can I apply a specific behavior to a spwaned object?
I'm spawning asteroids using the "Spawn Area" behavior on a Scene Object. I want to apply the "Random Velocity" behavior to each asteroid spawned by the "Spawn Area" functions.
I tried applying the "Random Velocity" to my template asteroid but it's not working...
I can change the "Spawn Area" behavior to directly apply the velocity to the objects but I would like to know how to do it the other way.
I'm spawning asteroids using the "Spawn Area" behavior on a Scene Object. I want to apply the "Random Velocity" behavior to each asteroid spawned by the "Spawn Area" functions.
I tried applying the "Random Velocity" to my template asteroid but it's not working...
I can change the "Spawn Area" behavior to directly apply the velocity to the objects but I would like to know how to do it the other way.
About the author
Developer at frogames.com / frogames.net
#2
10/26/2007 (2:55 am)
Actually, it depends on whats the function that really triggers the behavior, it could be onUpdateScene or any other function, so you just need to know which is it, and then call it.
Torque Owner Mathieu
I need to use "onBehaviorAdd" and not "onAddToScene".