0 votes

I'm thinking of adding a smart bomb (like in "Defender", not a clever bomb....) to my Asteroids game.
What's the best way of going about this? I don't want it to be instantaneous, i.e. instantly kill everything in a given radius, but to gradually spread from a point to radius in a second or so, timed with a particle explosion.

I was thinking of using a Colission2D shape and expanding its radius timed with the particle explosion.

Is this a sensible way to do it, or is there something I can do with the particle explosion alone or any other suggestions?

in Engine by (24 points)

1 Answer

+1 vote

It's about rendering.
You can have exoplosion art in your game, a spritesheet or something.
When the bomb explodes, start rendering. You can have a variable, something like rending_required, if it's true, call start_rendering(). You should create methods like start or end rendering. After you start, you can try to use AnimationPlayer, AnimatedSprite, or something else to do this animation with the spritesheet you have. To make sure that the explosion spreading size is right, you can use the property "scale" according to what radius is given.
If you want to remove the bomb after it explodes: There are two ways.
1. Only remove it after rendering finished.
2. Remove it immediately when exploding function is called and create a new animation scene for the rendering of the explosion effect.
Same for killing characters. Definitely you don't want to instantly kill everything without playing their death animations. It's similar to the bomb scene. When the bomb explodes, the bomb "dies" and the animation is "death". So when character dies, using the same way how you remove the bomb to not instantly get killed without rendering death animations.

by (811 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.