This repository has been archived on 2025-09-12. You can view files and clone it, but cannot push or open issues or pull requests.
ld47/game/NarrativePopup.gd

24 lines
510 B
GDScript

class_name NarrativePopup
extends Popup
const TIME_PER_CHAR: float = 0.03
onready var label = $Panel/RichTextLabel
var time_displayed: float = 0.0
var duration: float = 0.0
func _process(delta: float) -> void:
if !visible:
return
time_displayed += delta
if time_displayed > duration:
hide()
label.visible_characters = time_displayed / TIME_PER_CHAR
func display(msg: String, dur: float) -> void:
duration = dur
time_displayed = 0.0
label.bbcode_text = msg
label.visible_characters = 0
show()