How do I make a player Knockback NATURALLY?

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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

  • 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..

  • 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.

  • 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

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