Game Development Community

How is DoSpawn() used?

by rwillis · in Torque X 2D · 09/27/2007 (8:27 pm) · 1 replies

T2dSpawnObject has a method called DoSpawn. When should this be used?

Also, let's say I want to spawn an object from a spawner at the beginning of the game and then spawn again once that object is MarkForDelete'd. To do this would I just set SpawnEnabled to false right after the first object is spawned and then set SpawnEnabled back to true once it's MarkForDelete'd? How would I tell when the first object has spawned?

#1
09/28/2007 (5:37 pm)
DoSpawn clones the spawn template and registers the clone (essentially, "doing"/performing the spawn event).

For the second question, I created something similar to the spawn object for the checkpoint system in the Platformer Kit where I had spawn points that would interface with a SpawnedObjectComponent on the spawned object. That way, the spawned object has a reference to the spawner that spawned it and it could notify the spawn point when the object is destroyed.