From 330bac8d0ee915ac24384a32e8fbdec070243961 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 14 Apr 2024 06:26:14 +0200 Subject: [PATCH] Rename `Pickable` to `Draggable` and add the `drag` and `drop` methods --- behaviours/draggable.gd | 19 +++++++++++++++++++ behaviours/draggable.tscn | 6 ++++++ behaviours/pickable.gd | 2 -- behaviours/pickable.tscn | 6 ------ 4 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 behaviours/draggable.gd create mode 100644 behaviours/draggable.tscn delete mode 100644 behaviours/pickable.gd delete mode 100644 behaviours/pickable.tscn diff --git a/behaviours/draggable.gd b/behaviours/draggable.gd new file mode 100644 index 0000000..28c4b1b --- /dev/null +++ b/behaviours/draggable.gd @@ -0,0 +1,19 @@ +extends Node +class_name Draggable + + +signal dragged +signal dropped + + +var being_dragged: bool = false + + +func drag(): + being_dragged = true + dragged.emit() + + +func drop(): + being_dragged = false + dropped.emit() diff --git a/behaviours/draggable.tscn b/behaviours/draggable.tscn new file mode 100644 index 0000000..81be1f5 --- /dev/null +++ b/behaviours/draggable.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://dijcjahkddudv"] + +[ext_resource type="Script" path="res://behaviours/draggable.gd" id="1_hdedq"] + +[node name="Draggable" type="Node"] +script = ExtResource("1_hdedq") diff --git a/behaviours/pickable.gd b/behaviours/pickable.gd deleted file mode 100644 index 9f6f232..0000000 --- a/behaviours/pickable.gd +++ /dev/null @@ -1,2 +0,0 @@ -extends Node -class_name Pickable diff --git a/behaviours/pickable.tscn b/behaviours/pickable.tscn deleted file mode 100644 index be4ff48..0000000 --- a/behaviours/pickable.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://dijcjahkddudv"] - -[ext_resource type="Script" path="res://behaviours/pickable.gd" id="1_ymn8e"] - -[node name="Pickable" type="Node"] -script = ExtResource("1_ymn8e")