How do I make a "pressure wave" with force?

  • Hi,

    How do i make something like a pressure wave from an explosion that goes in all directions? I have an reactor block and when it gets destroyed it should explode an push every other block away.

    I tried it with force but that doesn't really work in all directions.

    Thanks!

  • Force is normally used when you want it continually for a period of time.

    What you are looking for is impulse, which is like a sudden jerk/impact.

    And here's an easy way to do this, in your case:

    [Reactor] On Destroyed, then Action:

    [Blocks] Set Impulse at Angle:

    Value: 5 (something from 5 to 10 would be a great impact force)

    Angle: angle(reactor.X, reactor.Y, block.X, block.Y) this will make the blocks go in opposite direction from the explosion

    Let me know if it worked.

  • Hasan999

    Thanks!

    It works great! Is there a way to set a radius so only blocks in that radius are pushed away?

    Thanks again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glad it helped !

    To pick nearer bricks, add another condition "Pick by Comparison" found under System conditions.

    Then input values as below:

    Object: Brick

    Expression: distance(reactor.X, reactor.Y, brick.X, brick.Y)

    Radius: 200 or whichever radius (in pixels) the bricks to be affected

  • Hasan999

    Thank you really much for your help!

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