frame-of-mind/src/logic-scenes/playable.gd

32 lines
851 B
GDScript3
Raw Normal View History

extends Control
class_name Playable
2026-01-18 20:01:20 +00:00
func _ready() -> void:
hide()
2026-01-19 10:49:31 +00:00
if get_parent() == get_tree().root:
play.call_deferred()
2026-01-18 20:01:20 +00:00
## Awaitable that encapsulates the core interaction with this Playable
func play() -> void:
push_warning("Playeable[base].play() not overridden")
await get_tree().process_frame # Dummy wait so this is a coroutine
2026-01-18 09:48:03 +00:00
func handle_hover(_area: Draggable):
#prints("Playable[base].handle_hover", _area, _area.name)
2026-01-18 16:32:31 +00:00
pass
2026-01-18 20:53:19 +00:00
const TRANSPARENT_BLACK := Color(0,0,0,0)
func appear():
2026-01-18 20:53:19 +00:00
self.modulate = TRANSPARENT_BLACK
show()
var tween := create_tween().set_ease(Tween.EASE_IN)
2026-01-18 20:53:19 +00:00
tween.tween_property(self, "modulate", Color.WHITE, 0.3)
await tween.finished
func vanish():
var tween := create_tween().set_ease(Tween.EASE_OUT)
2026-01-18 20:53:19 +00:00
tween.tween_property(self, "modulate", TRANSPARENT_BLACK, 0.3)
await tween.finished
hide()