Make player move towards cursor?

My player sprite moves at a set speed. What action (and formula) do I get it to move to the cursor location with a mouse click?

If you want to get a point-and-click movement, you will likely have places you don’t want the player to move to or through. Therefore I recommend you try the pathfinding feature. Define the zones the player cannot pass through with the pathfinding obstacle behavior. Then, add the pathfinding behavior to your player object, and when a click is done, use the action to make it move to CursorX()/CursorY(). It will move smoothly to that position while avoiding obstacles (and not go to the clicked place if it is unreachable).

2 Likes

Thank you, Arthuro! I will try that.