+1 vote

So i want to make a strategy game like starcraft.
When clicking somewhere on the screen, the player should move to that location.
Because move_to() was removed, i can't imagine how i can create a click-to-move system.
I tried

if Input.is_action_pressed("left_click"): //made an input map for left_click

but the player can move in just one direction

in Engine by (408 points)
edited by

Found the answer myself, i downloaded the pathfinding demo which showed me what i needed

In case it serves to someone, can be subtracted the mouse's position with the character's position, like this:

if Input.is_action_pressed("left_click"): //made an input map for left_click
 move_and_slide(get_global_mouse_position() - position)

1 Answer

+2 votes

You can find this one in official documentation page:

by (27 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.