Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | GunPoint |
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
move_and_slide(get_global_mouse_position())
but the player can move in just one direction
Help
Found the answer myself, i downloaded the pathfinding demo which showed me what i needed
GunPoint | 2018-02-02 12:37
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)
rjoshua | 2018-02-02 15:03