brackeys-12/ui/building_icon.gd

33 lines
587 B
GDScript3
Raw Normal View History

2024-09-12 02:40:54 +00:00
extends ColorRect
2024-09-14 00:09:38 +00:00
var key
var clicked = false
2024-09-12 02:40:54 +00:00
@onready var texture_rect: TextureRect = $TextureRect
2024-09-14 00:09:38 +00:00
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:
2024-09-14 01:02:26 +00:00
print(key)
print("DRAG 1")
2024-09-14 00:09:38 +00:00
if clicked:
2024-09-14 01:02:26 +00:00
print("DRAG")
2024-09-14 00:09:38 +00:00
Triggerer.trigger("drag_building", { "key": key })
clicked = false
func _on_mouse_handler_released() -> void:
2024-09-14 01:02:26 +00:00
print("SELECT 1")
2024-09-14 00:09:38 +00:00
if clicked:
2024-09-14 01:02:26 +00:00
print("SELECT")
2024-09-14 00:09:38 +00:00
Triggerer.trigger("select_building", { "key": key })
clicked = false