You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
407 B
GDScript
17 lines
407 B
GDScript
1 year ago
|
extends PanelContainer
|
||
|
|
||
|
var track = false
|
||
|
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
func _process(_delta):
|
||
|
if track:
|
||
|
global_position = get_global_mouse_position() - Vector2(size.x / 2, size.y / 2)
|
||
|
|
||
|
func _on_gui_input(event):
|
||
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
|
||
|
if event.pressed:
|
||
|
track = true
|
||
|
else:
|
||
|
track = false
|
||
|
|