I am making a SWAT strategy game so I worked on this for the movement. Feel free to give me suggestions or to take the code for your own project, as I don't believe there are any tutorials on how to do this. I will be trying to improve on this in the future. If you want to use this for your game just make the "WALLS" sprite your map borders/collision and change the "Character" costume. (P.S. don't forget to hide the lists and the variable. They're just here for debug)
Bugs: - Rotation is very choppy, as it must calculate the direction first. - When colliding with the wall, the movement will stop working for an unknown reason. - The speed at which you draw the line, impacts the speed of the movement