How would I make a 2D gun knockback?
Hello everyone! I'm making a 2D platformer 1v1 game, kinda similar to Broforce PVP I guess. I'd like my character to be pushed in the opposite direction to where he shoots (not pushing back the other player with bullets, I already have that one), but pushing himself with the recoil, allowing more mobility. I have tried several options, some working better than others, but no solution seemed to be right. (The one I got at the moment take the position of the mouse as a Vector2 at the moment the player shoots, but it seems to be a pretty bad idea, especially seems the other player is controlled with a controller). So, do you have any idea how I could do this?
Comment