How do i change the player sprite when using click to move in 4 directions?
Example: When clicking up the player sprite changes to the up animation. When clicking left or right it changes to those animations.
Click to move just changes the angle of the one sprite. How do i implement sprite change?
Develop games in your browser. Powerful, performant & highly capable.
you could measure the angle between the current position and the mouse poisition
angle(player.X, player.Y, Mouse.X, Mouse.Y)
so if it's between 0 and 90, change the animation frames to right, between 90 and 180 change to down etc...