How do I make a player Knockback NATURALLY?

Get help using Construct 2

Post » Fri Aug 26, 2016 8:36 pm

Hello.

First of all, I've looking at almost every single thread on the forum about knockback and none of them has been useful or fixed my problem so I decided to open a new one and see if I get lucky.

I'm trying to make my player get knockbacked whenever gets hit by an enemy, kinda like they did in Sonic back in the Mega Drive days, he will get pushed back up in the air.

I've tried with different events and none of them seems to do the trick for me. Either I need to come up with a good acceleration and some other good values or I'm just using the wrong events. Set platform vector is not working for me. I've tried some Physics also and can't seem to make it wortk either.

Any suggestions?
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Fri Aug 26, 2016 9:55 pm

B
33
S
18
G
28
Posts: 2,475
Reputation: 20,914

Post » Sat Aug 27, 2016 6:21 am

Hey there. I'm making a Zelda-like right now and I managed to create a Knockback by using the BULLET function.
Unfortunately I cannot upload the CAPX as there are many other things in there I worked on.
Somthing like:

Player On collision with [Object of Choice] >>> Set Bullet Speed to 400, Set bullet angle to [-angle of player and object]

Player Bullet Spd > 0 >>> Set Bullet Speed to [ (player bullet speed) - 1000*dt ]

You can just modify the dt multiplier and bullet speed to determine how much knockback you want.
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Sat Aug 27, 2016 6:47 am

I do something like this but i've create a sprite named : "knockbak" with Pin behavor
Knockback >>> pin to Player
When Player Collide with WhatYouWant >>> Knockback rotate toward WhatYouWant / Set bullet speed to 400 / Set bullet angle to (-angle of knockback)
........

This way prevent player to walk backward on a trap and get knockback in the wrong way, or when a enemies come from behind and push him.
B
11
S
3
Posts: 25
Reputation: 1,110

Post » Sat Aug 27, 2016 10:11 pm

MPPlantOfficial wrote:Hey there. I'm making a Zelda-like right now and I managed to create a Knockback by using the BULLET function.
Unfortunately I cannot upload the CAPX as there are many other things in there I worked on.
Somthing like:

Player On collision with [Object of Choice] >>> Set Bullet Speed to 400, Set bullet angle to [-angle of player and object]

Player Bullet Spd > 0 >>> Set Bullet Speed to [ (player bullet speed) - 1000*dt ]

You can just modify the dt multiplier and bullet speed to determine how much knockback you want.


Yeah but the knockback would be kinda stiff not really natural for a platformer. Still I will try it. But..

What do you mean by -angle of player and object, could you make an example?

Thanks
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sat Aug 27, 2016 10:34 pm

To make the knockback I used the set vector x and y.

On collision with enemy
If player x < enemy x: set y vector -600 (or use the same value of jump strenght) and set x vector -100 (you should test the best value)
ELSE : set y vector -600 and x vector 100.

You also have to work with the animation to set mirrored or not..
B
65
S
32
G
69
Posts: 217
Reputation: 40,008

Post » Sun Aug 28, 2016 3:23 pm

nemezes wrote:To make the knockback I used the set vector x and y.

On collision with enemy
If player x < enemy x: set y vector -600 (or use the same value of jump strenght) and set x vector -100 (you should test the best value)
ELSE : set y vector -600 and x vector 100.

You also have to work with the animation to set mirrored or not..


Tried that also, not doing the desired effect I was looking for.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sun Aug 28, 2016 8:05 pm

@Smileh another solution is to make the player jump, you disable the controls and use the jump.. maybe you can get the desired effect. You will Just to deal with the animations
B
65
S
32
G
69
Posts: 217
Reputation: 40,008


Return to How do I....?

Who is online

Users browsing this forum: bluesun66 and 2 guests