diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-11 12:44:41 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-11 12:44:41 -0400 |
commit | 97c365e5d2932f6cd1a871d82072aab5d78a653e (patch) | |
tree | 150d241cfbe831c3d60854eb0fff2803b628888c /Archipelago/messages.gd | |
parent | dfabc170a4b9cda3c290eb5160616cf4af406e61 (diff) | |
download | lingo-archipelago-97c365e5d2932f6cd1a871d82072aab5d78a653e.tar.gz lingo-archipelago-97c365e5d2932f6cd1a871d82072aab5d78a653e.tar.bz2 lingo-archipelago-97c365e5d2932f6cd1a871d82072aab5d78a653e.zip |
Use base game messages node
Now that it's been integrated into the game itself.
Diffstat (limited to 'Archipelago/messages.gd')
-rw-r--r-- | Archipelago/messages.gd | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/Archipelago/messages.gd b/Archipelago/messages.gd deleted file mode 100644 index fbe7564..0000000 --- a/Archipelago/messages.gd +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | extends Node | ||
2 | |||
3 | var _message_queue = [] | ||
4 | var _font | ||
5 | var _container | ||
6 | var _ordered_labels = [] | ||
7 | |||
8 | |||
9 | func _ready(): | ||
10 | _container = VBoxContainer.new() | ||
11 | _container.set_name("Container") | ||
12 | _container.anchor_bottom = 1 | ||
13 | _container.margin_left = 20.0 | ||
14 | _container.margin_right = 1920.0 | ||
15 | _container.margin_top = 0.0 | ||
16 | _container.margin_bottom = -20.0 | ||
17 | _container.alignment = BoxContainer.ALIGN_END | ||
18 | _container.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
19 | self.add_child(_container) | ||
20 | |||
21 | _font = DynamicFont.new() | ||
22 | _font.font_data = load("res://fonts/Lingo.ttf") | ||
23 | _font.size = 36 | ||
24 | _font.outline_color = Color(0, 0, 0, 1) | ||
25 | _font.outline_size = 2 | ||
26 | |||
27 | |||
28 | func _add_message(text): | ||
29 | var new_label = RichTextLabel.new() | ||
30 | new_label.push_font(_font) | ||
31 | new_label.append_bbcode(text) | ||
32 | new_label.fit_content_height = true | ||
33 | |||
34 | _container.add_child(new_label) | ||
35 | _ordered_labels.push_back(new_label) | ||
36 | |||
37 | |||
38 | func showMessage(text): | ||
39 | if _ordered_labels.size() >= 9: | ||
40 | _message_queue.append(text) | ||
41 | return | ||
42 | |||
43 | _add_message(text) | ||
44 | |||
45 | if _ordered_labels.size() > 1: | ||
46 | return | ||
47 | |||
48 | var timeout = 10.0 | ||
49 | while !_ordered_labels.empty(): | ||
50 | yield(get_tree().create_timer(timeout), "timeout") | ||
51 | |||
52 | var to_remove = _ordered_labels.pop_front() | ||
53 | var to_tween = get_tree().create_tween().bind_node(to_remove) | ||
54 | to_tween.tween_property(to_remove, "modulate:a", 0.0, 0.5) | ||
55 | to_tween.tween_callback(to_remove, "queue_free") | ||
56 | |||
57 | if !_message_queue.empty(): | ||
58 | var next_msg = _message_queue.pop_front() | ||
59 | _add_message(next_msg) | ||
60 | |||
61 | if timeout > 4: | ||
62 | timeout -= 3 | ||