# Explosion

0 favourites
• 7 posts
From the Asset Store
540 Realistic Gun, Explosion and Additional Sounds
• Hi

I see some topic's about explosion, but i need some good idea how make it work smooth.

I wanna make with some TNT and Granades, using physic and i dont know how make explosion with is stronger if is near object and have less power when is litte far.

(sorry for my english)

• Any ideas on this? I'm also interested.

• You could use the DISTANCE system expression. Get the result and depending on how far apart they are, use a different animation, or force etc to display the explosion.

distance(x1, y1, x2, y2)

Here's a simple CAPX to show you. Click the mouse around the red sprite. The closer you are the bigger the explosion (boom is a small one KABOOM! is bigger). Of course you could set a few tests to increase the size of the explosion as you get closer, but for this I've only done one test.

BOMB TEST CAPX

Shout up if you need more help :)

• Using distance looks nice, but I would like a more dynamic explosion instead of just 2 or 3 levels of strength. For instance, if the explosion happens 1 pixel away from an object, then apply a strength of a 99, if it's 2 pixels away, strength of 98...etc. I guess we could still use the distance expression for it, but the problem is it would be reversed, the closer the explosion happens, the less potent the number would be: 1 pixel away = strength of 1, 2 pixels away = strength of 2.

• What you do with the explosion is up to you, I could've made it say boom closer to the player (square) and KABOOM! if it was further away. As for a smoother check, I'm not 100% on that, there is probably a formula you could use (maybe using the LERP command?) I'm sure someone smarter than me could help with that on here.

:)

• there are number of ways you can make explosion with physics, but here is one extremely ugly way to do it (always love to construct when i'm drunk) <img src="smileys/smiley11.gif" border="0" align="middle"> .

you can even check for LOS to make it more "real"

exploding bomb that explodes

edit: change range to limit bomb "infuluence"/radius, left clikc for bomb, right click for TNT(left clikc on TNT to acivate it), play with values of power...

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Wow Man, that's awesome! Thats the effect i want have in my game. Thank You :D

• 7 posts