2024-04-16 01:56:46 +00:00
|
|
|
@icon("res://behaviours/draggable.svg")
|
2024-04-14 05:21:24 +00:00
|
|
|
extends Area2D
|
2024-04-14 04:26:14 +00:00
|
|
|
class_name Draggable
|
|
|
|
|
|
|
|
|
2024-04-20 02:11:14 +00:00
|
|
|
signal dragged(cursor: Cursor)
|
|
|
|
signal dropped(cursor: Cursor)
|
2024-04-14 04:26:14 +00:00
|
|
|
|
|
|
|
|
2024-04-16 01:56:46 +00:00
|
|
|
var being_dragged: bool = false
|
2024-04-14 04:26:14 +00:00
|
|
|
|
|
|
|
|
2024-04-20 02:11:14 +00:00
|
|
|
func drag(cursor: Cursor):
|
2024-04-14 04:26:14 +00:00
|
|
|
being_dragged = true
|
2024-04-20 02:11:14 +00:00
|
|
|
dragged.emit(cursor)
|
2024-04-14 04:26:14 +00:00
|
|
|
|
2024-04-20 02:11:14 +00:00
|
|
|
func drop(cursor: Cursor):
|
2024-04-14 04:26:14 +00:00
|
|
|
being_dragged = false
|
2024-04-20 02:11:14 +00:00
|
|
|
dropped.emit(cursor)
|