The plan was to calculate the slope between the two points(character and cursor), convert it to an angle to the horizontal, and depending on that angle, switch to a specific character sprite so that it appears to be pointing at the cursor(example: 0-30 degrees, one sprite. 30-60 degrees, another sprite. 60-90 another, etc). The problem I encountered afterward was that the slopes could mirror each other in a way.
I realized the (now seemingly obvious) problem was that having the character at point A and the cursor at point B would have the same slope/angle as the character point B and the cursor at point A. It had no way of knowing the direction to point.

I’m at a loss as to what to do from here. The simplest solution would be to have it so that the direction of the player wouldn’t be found out through this way(whether it’s facing right or left), but through the arrow keys, but I’m saving that as a last resort as it would cause problems with quickly aiming.
1 Answer