How do I do player/enemy knockback?

0 favourites
  • 5 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • I'm making a zelda, top down, 8 direction movement, type game.

    I want the enemy to be knocked back when hit. And if possible, at the same angle that they were hit at.


    Subscribe to Construct videos now

    You can see within the first 15 seconds, how whenever The Player hits an enemy with his sword they are knocked back a certain distance at a specific angle. ALSO when The player is hit, he is knocked back in the same manner.

    I messed around using physics behavior and didn't have much luck. I also tried doing bullet movement and only turning on the bullet movement when struck for 0.3 sec at an angle of the sword swing. But I didn't get very far with that either.

    Any help would be greatly appreciated! Thank you for your time!

  • I'm not the greatest at this but try this:

    On collision with Enemy => Move Player at Angle Enemy.Angle Distance 50

    Hope this helps!

  • try to aply a vector x or y in the inverse direction of the collision

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wish there was an inverse() function

  • ... .capx?dl=0

    A rough draft. You'll have a lot of tweaking to do with the angle of motion to get it to how you like. You may want to try using an imagepoint on the sword rather than the player origin to base your angle off of. Also the speed and acceleration (deceleration in this case) can be tweaked as well to get the type of motion you want. A more complicated formula will get you the rapid decay or "eased out" motion as used in Zelda.

    Tebbo - Angle=Angle+180 would be inverted angle, variable=constant-variable gives you invertable values. Unless you had something else in mind for inverse()?

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