7 lines
259 B
GDScript
7 lines
259 B
GDScript
extends Node2D
|
|
|
|
func _on_area_2d_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
|
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
|
var destination = get_global_mouse_position()
|
|
position = position.move_toward(destination, 100)
|