Game Development Community

Where are spawner objects in the code?

by John Bura · in Torque X 2D · 06/01/2010 (11:06 am) · 3 replies

Hi there,

I would like to turn on an off spawner objects at certain points in the game. How do you turn on an off a spawner object?

Thanks :)

#1
06/02/2010 (2:50 pm)
You can either turn off an existing spawner or write your own it's pretty easy. Have you looked at my starter kit? www.torquepowered.com/community/resources/authorID/100955

or name the spawner in the editor when you create it, then use (this assumes you named your spawner "MySpawner")
T2DSpawnObject theSpawner = TorqueObjectDatabase.Instance.FindObject<T2DSpawnObject>("MySpawner");

if(theSpawner != null)
{
    theSpawner.SpawnEnabled = false;
    // or whatever else you want to do
    // like theSpawner.MarkForDelete = true;
}

if you look at the code in T2D/T2DSpawnObject.cs there are other things you can do there as well, like fire a spawn manually.

#2
06/02/2010 (7:27 pm)
Wow thank you so much :) :)
#3
06/25/2010 (3:51 pm)
*edit*

I put it in the wrong spot.. Noob mistake.