brackeys-12/info_window.gd

37 lines
804 B
GDScript3
Raw Normal View History

2024-09-12 02:04:24 +00:00
extends Control
2024-09-14 00:09:38 +00:00
var window_tween
2024-09-12 02:04:24 +00:00
func _ready() -> void:
2024-09-14 00:09:38 +00:00
Triggerer.listen("show_info", _show_info_window)
Triggerer.listen("hide_info", _hide_info_window)
2024-09-14 00:20:51 +00:00
scale = Vector2.ZERO
2024-09-14 00:09:38 +00:00
func _show_info_window(data):
visible = true
if window_tween:
window_tween.kill()
window_tween = create_tween()
window_tween.set_ease(Tween.EASE_OUT)
window_tween.set_trans(Tween.TRANS_BACK)
2024-09-14 00:20:51 +00:00
window_tween.tween_property(self, "scale", Vector2.ONE, 0.5)
func _process(delta: float) -> void:
if Input.is_action_just_pressed("rclick"):
_hide_info_window({})
2024-09-12 02:04:24 +00:00
2024-09-14 00:09:38 +00:00
func _hide_info_window(_data):
if window_tween:
window_tween.kill()
window_tween = create_tween()
2024-09-14 00:20:51 +00:00
window_tween.set_ease(Tween.EASE_IN)
window_tween.set_trans(Tween.TRANS_QUAD)
window_tween.tween_property(self, "scale", Vector2.ZERO, 0.25)