Physics Explosion

0 favourites
  • 13 posts
From the Asset Store
200+ Unique, Single-Frame Explosion sprites! This is the ultimate explosion sprite bundle!
  • I've been over the forums and there seems to be LOTS of ways to do these physics "bomb" explosions.

    Most of the solutions on the forums work great with single objects, but when I start stacking objects, it's almost as if the power is diminished.

    Is there a single concrete way to make a box explode, in all directions, with equal force? or is it Impulse?

    Thanks in advance

  • are you talking about an explosive box splitting into parts first? or just the objects around it getting pushed away?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just pushing the other objects out of the way.

  • Impulse at angle.

    Angle(bombX,bombY,objectX,objectY)

  • preview

    There is a second method in this .capx, which applies a force to the 4 corners of the box instead of just the centre.

    This is so that even if the explosion centre only has a direct line to one of the corners, it will still push it.

    .capx

  • Awesome guys that's working great. It's just moving everything on the screen. I think I need to add some kind of distance or something, or is it suppose to move everything?

    Thanks for the replies you 2!

  • dooley did you check my cap before posting?

    it takes into account distance etc

  • I could not open it as it uses r126, i'm still using the stable r119. But thanks for posting it. I figured it out, at least for my purposes....

    System:(Compare 2 Values)...

            distance(Box.X,Box.Y,Item.X,Item.Y)

            is "less than or equal to"

            (w/e distance in pixels you want.)

    Thanks for all the help guys!

    p.s. on my last project r126 screwed up the bullet speed of my spawned objects. in r119 I had set a certain speed, with r126 it slowed all my "bullets" down. so I rolled back to r119.

  • you should probably accommodate for any changes an update makes, it can be a little annoying sometimes but it'll be easier in the long run

    but anyway, if you multiply your force by 1-(distance/radius)

    so it looks something like:

    Force*(1-(distance/radius))

    (where radius is the maximum distance)

    It means the force will be less the further away the object is.

    you know, so it won't be weird when an object is 1px outside of the radius and isnt affected at all, but then may be just touching the radius and suddenly will be blasted away at full force.

  • dooley There was a bug in r119 where if you had an object with solid behavior in a family with bullet behavior it travelled at double speed. That would explain your slowdown in r126.

  • keepee Ok, i'll check out that formula in just a min and report back to ya. Thanks.

    ramones it was just a sprite, a snake, that moved at bullet speed 100. when i ran it in r126 is slowed it way down. But thanks for the heads up with the solid/bullet thing. Thanks.

  • keepee It worked PERFECTLY! Thank you so much. You really should write up a Tutorial on this.

    Thanks again!

  • Thanks keepee for sharing that example and CAPx file. <img src="smileys/smiley4.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)