I’m developing a 2d isometric game on a engine made by myself (as a way to practice Java), however i’m stuck on what it seems to be a math problem, since I’m very bad at it. I can’t figure out to get the angle and change the X and Y velocity based on the angle.
I wish I could have some help on how to implement a 360 degree movement system based on Mouse Position, but the character should move in a straight line, based on the mouse angle relative to the center of the screen (where the player will be). The screen itself should work like a compass, and where the mouse clicks on it, the character should walk on said angle.
Example, my native resolution is 512×288. Center point is 256×144. So, If I click in in the coordinate of X = 256 and Y is 0~144, the character should walk on a perfect stright line upwards. If Y is 145~288, then, a perfect line downwards.
Any help is welcome!