brackeys-12/ui/building_icon.gd
2024-09-13 21:02:26 -04:00

32 lines
587 B
GDScript

extends ColorRect
var key
var clicked = false
@onready var texture_rect: TextureRect = $TextureRect
func _on_mouse_handler_clicked() -> void:
clicked = true
func _on_mouse_handler_hovered() -> void:
pass # Replace with function body.
func _on_mouse_handler_unhovered() -> void:
print(key)
print("DRAG 1")
if clicked:
print("DRAG")
Triggerer.trigger("drag_building", { "key": key })
clicked = false
func _on_mouse_handler_released() -> void:
print("SELECT 1")
if clicked:
print("SELECT")
Triggerer.trigger("select_building", { "key": key })
clicked = false