Top-down physics - can I simulate a shockwave?

0 favourites
  • 8 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • Hi there,

    Still quite new to Construct 2 but having a great time with it. At the moment I'm working on a top-down, twin-stick shooter (a l� Smash TV of old).

    I'd like to add an element where the player can press a button to release a 'shockwave' from his suit, pushing enemies back - so a rapidly expanding circle with a defined radius that has a knockback effect on anything it hits. Is this possible and how would I go about it? I've read the tutorials and I've been playing about with the physics functions a bit but I'm still not really sure where to begin!

  • At this point , physics behavior only work with platformer ... You might need to code all of this on your own ...

  • Very likely you would expand a circle outward from the center of the player (maybe using Sprite.setScale()?), and check for collisions at each step. If a collision occurs, you would move the enemy(or whatever) object at an angle (found by taking the system.angle(x1,y1,x2,y2).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can use physics in top down. Just set the world gravity to 0 and move all the sprites via normal movement functions.

    Have a circle sprite that expands (scale) and then it collides with the enemy, Apply Impulse at Angle. See cincipon's formulas.

    It's do able.

    You will have to wrestle with things colliding on their own though.

  • Very likely you would expand a circle outward from the center of the player (maybe using Sprite.setScale()?), and check for collisions at each step. If a collision occurs, you would move the enemy(or whatever) object at an angle (found by taking the system.angle(x1,y1,x2,y2).

    Cheers - I'm with you up until you said "taking the system.angle(x1,y1,x2,y2)" - how would that work and what action would I use? If I'm applying an impulse, how do I tell it which direction to push them in? (So enemies above the player are pushed up, ones to the right are pushed right etc)

  • The action is "Apply Impulse at Angle" and the Parameter is the formula to find out the angle between the player and the object to apply impulse to.

    So whenever you select an action (almost any action) there is a window with a textbox that you can type into to input X and Y or whatever you are inputting. Above (I think) that is a greyed out textbox that appears, and becomes opaque when you hover over it (@Ashley I think this is a bad UX decision). Once you've found that, you can pcik the System object, then scroll down and pick the angle expression, and it will help you along.

    Once you get more used to this sort of thing it will become MUCH friendlier to say sytem.angle(x,x,y,y) or object.Platform.VectorY than it will be to say click this choose that do this. =) Good luck!

    Play around with it, if you fail, put together a capx and link to it here and we can look into it.

  • Thanks, I've figured it out now. Works a treat!

  • Wonderful! I _LOVE_ Smash TV! Good luck.

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