Clear Screen of all spawned Spawner Objects
by Stuart Walton · in Torque X 2D · 05/08/2008 (1:29 pm) · 3 replies
Is there a command that will destroy all sprites on the screen that have been spawned from a Spawner Object.
So if the player dies all enemies on the screen disapear, I know the SpaceShooter game does this but the code varies significantly to the code i based my game on from the defender tutorial.
So if the player dies all enemies on the screen disapear, I know the SpaceShooter game does this but the code varies significantly to the code i based my game on from the defender tutorial.
About the author
#3
Then, after your level is over I think just do:
and all your objects should be unregistered.
Side note: If you have components that are listening to an event then I think you have to set them to silence those events in the components UnRegister method, or else the obejct will still receive events even though it was unregistered.
05/10/2008 (2:14 pm)
Before you start the level you can set a folder that all registered object will be stored in. Then when you want to unregister all of those objects, you can just unregister the folder.TorqueFolder levelFolder = new TorqueFolder (); TorqueObjectDatabase.Instance.Register(levelFolder ); TorqueObjectDatabase.Instance.CurrentFolder = levelFolder ;
Then, after your level is over I think just do:
TorqueObjectDatabase.Instance.Unregister(levelFolder);
and all your objects should be unregistered.
Side note: If you have components that are listening to an event then I think you have to set them to silence those events in the components UnRegister method, or else the obejct will still receive events even though it was unregistered.
Torque 3D Owner Will O-Reagan
Modern Intrigues
Will-O