[Solved] Knockback angle dynamic to location of mouse?

Hi, I’m trying to make a knockback system that will apply a force towards the opposite angle that the mouse is currently located. For more context, a simple shotgun knockback system that pushes the player away from where you are aiming. I can’t currently find a simple way to do this. I am using the platformer behavior for my player. If anyone can give me some advice I would be very thankful!

Find the angle between the player and mouse, and apply a negative force in that direction?

From what I’ve seen in the release notes, there are now expressions for finding the angle between two objects.

2 Likes

Thank you so much! I’m new to GDev and was not aware of those expressions. It works beautifully! :slight_smile: