Destorying all enemy at the screen?
by Denis Linardic · in Torque Game Builder · 10/09/2005 (12:45 pm) · 5 replies
Hi guys! does any one know how could I destroy all enemies currently on the screen.
I am trying to do that in spacescroller demo. I have created a few upgrades and one of them should destroy all objects (enemy) on the screen.
Thanks in advance!
I am trying to do that in spacescroller demo. I have created a few upgrades and one of them should destroy all objects (enemy) on the screen.
Thanks in advance!
About the author
#2
- Melv.
10/10/2005 (1:41 am)
You could also use one of the picking functions to select an area/group(s)/layer(s) and iterate that list of objects as Stephen suggests.- Melv.
#3
Let's say that all enemies are setup in layer 3, you mean that I can destroy all objects that are assigned in that layer? If so can you please provide a small example...please :)
I understand that command kill will destroy object, and I could probably before issuing that command call for some particle effect so everything looks real :)
P.S. I am amazed how good T2D is even in not finished state, congrats to you guys on creating this one. This engine makes one man team very possible :)
10/10/2005 (4:26 am)
Hmmm Melv that's an interesting approach if I understood correctly.Let's say that all enemies are setup in layer 3, you mean that I can destroy all objects that are assigned in that layer? If so can you please provide a small example...please :)
I understand that command kill will destroy object, and I could probably before issuing that command call for some particle effect so everything looks real :)
P.S. I am amazed how good T2D is even in not finished state, congrats to you guys on creating this one. This engine makes one man team very possible :)
#4
So if your scene is 800x600 and all the enemies are in group 5, then do something like this (I haven't tested this, so you might need to play around with it a bit):
10/11/2005 (12:48 pm)
Check out the pick functions (under sceneGraph2D) in the reference documentation. You will probably want to use pickRect(start x/y, end x/y, [groupMask], [layerMask], [showInvisible]).So if your scene is 800x600 and all the enemies are in group 5, then do something like this (I haven't tested this, so you might need to play around with it a bit):
%enemiesList = t2dSceneGraph.pickRect("0 0", "800 600", BIT(5));
%enemiesCount = getWordCount(%enemiesList);
for(%i = 0; %i < %enemiesCount; %i++)
{
%enemyWhoWillDie = getWord(%enemiesList, %i);
%enemyWhoWillDie.explode();
}
#5
10/13/2005 (4:24 am)
Thanks, I solved that!
Torque 3D Owner Stephen Zepp