From 9e25d08020e6b75c4bd7a61a3ce055e2d515bb91 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 20 Apr 2024 04:11:14 +0200 Subject: [PATCH] Add a `Cursor` parameter to `drag` and `drop` --- behaviours/draggable.gd | 12 ++++++------ scenes/game/cursor.gd | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/behaviours/draggable.gd b/behaviours/draggable.gd index 26ad854..5587747 100644 --- a/behaviours/draggable.gd +++ b/behaviours/draggable.gd @@ -3,17 +3,17 @@ extends Area2D class_name Draggable -signal dragged -signal dropped +signal dragged(cursor: Cursor) +signal dropped(cursor: Cursor) var being_dragged: bool = false -func drag(): +func drag(cursor: Cursor): being_dragged = true - dragged.emit() + dragged.emit(cursor) -func drop(): +func drop(cursor: Cursor): being_dragged = false - dropped.emit() + dropped.emit(cursor) diff --git a/scenes/game/cursor.gd b/scenes/game/cursor.gd index 2bb2622..7f9a360 100644 --- a/scenes/game/cursor.gd +++ b/scenes/game/cursor.gd @@ -36,14 +36,14 @@ func drag(): var target = find_closest_target() if target and not dragging: dragging = target - target.drag() + target.drag(self) dragged.emit(target) func drop(): if dragging: var target = dragging dragging = null - target.drop() + target.drop(self) dropped.emit(target) func log_dragging() -> void: