From eb081515c0c5aaeee9e1dd1e139f0455ae924a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?= Date: Fri, 4 Apr 2025 17:37:23 +0200 Subject: [PATCH] feat: instantiate dragon with drag and drop --- scenes/window/draggable.gd | 5 +++++ scenes/window/dragon.gd | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scenes/window/draggable.gd b/scenes/window/draggable.gd index d19f356..6efec7f 100644 --- a/scenes/window/draggable.gd +++ b/scenes/window/draggable.gd @@ -12,6 +12,11 @@ func _ready() -> void: set_process_input(true) +func initial_drag(): + dragging_start_position = get_global_mouse_position() + dragging = true + + func _input(event) -> void: if event is not InputEventMouseButton: return diff --git a/scenes/window/dragon.gd b/scenes/window/dragon.gd index bd06503..b9ff932 100644 --- a/scenes/window/dragon.gd +++ b/scenes/window/dragon.gd @@ -20,7 +20,7 @@ func on_place_back() -> void: func _ready() -> void: - _pick_random_screen_position() + draggable.initial_drag() func _process(delta: float) -> void: