How do I do player/enemy knockback?

Get help using Construct 2

Post » Wed May 21, 2014 10:47 pm

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.

EXAMPLE VIDEO: http://www.youtube.com/watch?v=OLSQ8K1jSWw

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!
B
3
Posts: 1
Reputation: 202

Post » Thu May 22, 2014 12:01 am

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!
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Tue May 27, 2014 5:03 pm

try to aply a vector x or y in the inverse direction of the collision
Carlo Andrei Mercado

Animator, illustrator, concept artist, special effects for games.

[email protected]

http://f-fman.wix.com/portfolio-ffman22

http://ffman22.deviantart.com/



tutorials:



https://www.scirra.com/tutorials/950/dynamic-mini-map dynamic-mini-map tutorial



https://www.scirra.com/tutorials/9479/p ... ing-damage falling damage platform tutorial



originally published by ffman22
B
56
S
16
G
3
Posts: 324
Reputation: 5,604

Post » Wed Sep 28, 2016 6:04 am

I wish there was an inverse() function
B
4
Posts: 8
Reputation: 218

Post » Wed Sep 28, 2016 6:44 am

https://www.dropbox.com/s/zqa1oylpr0hxw ... .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()?
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: ladjuric, plinkie, Syazanie Amirin and 3 guests