about summary refs log tree commit diff stats
path: root/Archipelago/messages.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/messages.gd')
-rw-r--r--Archipelago/messages.gd35
1 files changed, 35 insertions, 0 deletions
diff --git a/Archipelago/messages.gd b/Archipelago/messages.gd new file mode 100644 index 0000000..63ce182 --- /dev/null +++ b/Archipelago/messages.gd
@@ -0,0 +1,35 @@
1extends Node
2
3
4func _ready():
5 var label = Label.new()
6 label.set_name("label")
7 label.margin_right = 1920.0
8 label.margin_bottom = 1080.0 - 20
9 label.margin_left = 20.0
10 label.align = Label.ALIGN_LEFT
11 label.valign = Label.VALIGN_BOTTOM
12
13 var dynamic_font = DynamicFont.new()
14 dynamic_font.font_data = load("res://fonts/Lingo.ttf")
15 dynamic_font.size = 36
16 dynamic_font.outline_color = Color(0, 0, 0, 1)
17 dynamic_font.outline_size = 2
18 label.add_font_override("font", dynamic_font)
19
20 add_child(label)
21
22
23func showMessage(text):
24 var label = self.get_node("label")
25 if !label.text == "":
26 label.text += "\n"
27 label.text += text
28
29 yield(get_tree().create_timer(10.0), "timeout")
30
31 var newline = label.text.find("\n")
32 if newline == -1:
33 label.text = ""
34 else:
35 label.text = label.text.substr(newline + 1)