18 lines
403 B
GDScript
18 lines
403 B
GDScript
extends Node2D
|
|
|
|
var follower = false
|
|
|
|
func _ready() -> void:
|
|
follower = true
|
|
set_process_input(true)
|
|
|
|
func _process(delta: float) -> void:
|
|
if follower:
|
|
position = get_viewport().get_mouse_position()
|
|
|
|
|
|
func _input(event):
|
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
|
if abs(position) <= get_viewport().get_mouse_position():
|
|
follower = false
|