How Do I Add KnockBack

I’m wondering how to add knock back to my game in my platformer?
I want to so that my shotgun will give the player a massive knock back and will launch the player, this will be your way of jumping. I want to know how will this be possible, i want it so that when you go flying the speed will stop when you hit the floor.
If you need any more pictures then I can add as many as you want

These are more screenshots since it doesn’t allow new users to use more than 1 image for some reason

Here’s a potential solution. Add a variable called “KnockBack_Force” to the player character, and use the following:

I would say it helps
Desktop 2025.01.08 - 21.58.09.02
but when the gun is facing certain points it goes into the direction that I don’t want it to go? Do you know a fix on this?

Instead of checking the horizontally flipped status, check whether the cursor is to the left or right of the player, and apply the force accordingly.

1 Like

thank you! here is what I have for the code!

Since you already have the angle of the shotgun, why not just apply force in the opposite direction (i.e. shotgun.angle + 180)

1 Like

I’ll have to try that