How do I create a bomb that explodes multiple sprites/projectiles?

Hi, I want to create a projectile of some sort that acts like a bomb; destroys multiple sprites/projectiles. Does anyone know how to do this?

3 Likes

There are several ways of achieving what you described :grinning:

I recommend you link a demo / game to explain what you exactly need the bomb to do / behave like! (For example: Does it explode in a circle radius or bomberman style? Does it explode when the player pressed a button or when something overlaps it? etc).

1 Like

Easiest way is to create a large sprite (explosion) delayed after the bomb sprite (small and no dmg) The explosion sprite has a specific sprite kind which you could use with the overlap blocks to trigger the destruction of the sprites and projectiles.
Since these would be different overlaps, using a function with 2 sprite parameters could save on copying it multiple times for every sprite you want to affect.

The obvious option would be to have On Sprite Kind Overlap interactions coded for every type of destroyable sprite. The problem I usually have is making the bomb big enough to have a good explosion radius and having the explosion animation centered where I want it. One option you might try is checking every sprite to see if they are in the explosion radius using Pythagorean Theorem or an extension to tell how far away an enemy is and destroying the sprites that are in that radius. This would make your explosion easier to customize and stuff. Obviously, this only works for circular explosions, though the math could easily be tweaked somewhat.