How to destroy all enemies on screen at once
butterbean
Member Posts: 4,315
Just wondering how to create a rule to destroy all enemies on the screen at once, such as with an item drop?
Comments
Create an actor that covers the whole screen. You should have it always on screen, but invisible.
Have an attribute called 'smart bomb' - have it set to false.
Then if you press a button, smart bomb is true.
On all your enemies, have as a destroy behaviour 'If smart bomb is true, then destroy'.
Hope that helps - it should work...
Cheers,
QS
Edit - or, have no actor at all and just make it so that when smart bomb is true, destroy actor!
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Create a boolean game attribute called DestroyNow, and have it set to 0 (false).
In the code for your enemies (I assume they're spawned and share the same behaviors) create a rule that says When Attribute game.DestroyNow = True, Destroy.
When you have the "item drop" event, Change Attribute to set game.DestroyNow to 1 (True).
You'll need to reset the DestroyNow attribute to 0 (False) at some logical point in the game as well, perhaps after a timer expires, giving all the enemies time to see the attribute change and destroy themselves.
Hope this helps,
Steve
Actually, thinking about what I said earlier - having an actor that fills the screen might work - if you press the button, the actor's spawned for .3 seconds or whatever, and if the enemies collide with it, they're destroyed.
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io