Game Development Community

aStar, spawners, sceneobject and behaviors

by Shakey · in Torque Game Builder · 12/06/2009 (3:26 pm) · 2 replies

Here is my question

In the aStar tutorial, random butterflies are spawned and I guess will continue to spawn for the duration of the program. In the app, the sceneobject is the spawner. In my app I want one spawner, so there is no reason to randomize, is there?

Let's talk about the enemy. I know the enemy is associated with the spawners, but I have a set amout of enemies that will spawn and follow a path until they reach the end. Can someone give me advice as to spawn, say 10 enemies, one after another, until the destination is reached.

I see in the tutorial that the enemy template is clonedwithbehaviors, where is clonedwithbehavoir defined. I can't seem to find it. Is it using behaviors.

Any help will be helpful.

#1
12/07/2009 (12:24 pm)
Anybody?
#2
12/07/2009 (4:37 pm)
Quote:In the aStar tutorial, random butterflies are spawned and I guess will continue to spawn for the duration of the program. In the app, the sceneobject is the spawner. In my app I want one spawner, so there is no reason to randomize, is there?

Correct, there is no reason to randomize.

Quote:Let's talk about the enemy. I know the enemy is associated with the spawners, but I have a set amout of enemies that will spawn and follow a path until they reach the end. Can someone give me advice as to spawn, say 10 enemies, one after another, until the destination is reached.

TGB comes with several example projects, find the behavior playground project and in the behaviors/ai folder is a behavior called spawn area. Attach this behavior to a scene object in your level as the spawn point and there should be configuration settings that allow you to specify 10 enemies, for example.

Quote:I see in the tutorial that the enemy template is clonedwithbehaviors, where is clonedwithbehavoir defined. I can't seem to find it. Is it using behaviors.

cloneWithBehaviors is a function of t2dSceneObject, not a behavior. A typical usage is to place an enemy outside the camera view of the level, give it the behaviors, collision properties, etc, you want and also include the template behavior on this enemy. The template behavior disables the object when the level is loaded but any clones created are enabled and work properly when added to the scene. This gives you the benefit of only needing to create one "master enemy" and copying it during gameplay (using the cloneWithBehaviors function) as many times as you wish instead of adding 10 enemies to the scene in the builder and needing to set up the properties of each one individually.