-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_hud.tscn
53 lines (42 loc) · 1.64 KB
/
test_hud.tscn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
[gd_scene load_steps=2 format=3 uid="uid://ryujplit1o45"]
[sub_resource type="GDScript" id="GDScript_sycoj"]
script/source = "extends Control
@onready var n_label: Label = $VBoxContainer/Label
func _ready():
n_label.text %= Game.get_gamemode().resource_name
func _on_switch_gamemode_button_pressed():
if Game.get_gamemode() is TestGamemode:
Game.get_level().game_mode = load(\"res://test2_gamemode.tres\")
else:
Game.get_level().game_mode = load(\"res://test_gamemode.tres\")
func _on_switch_level_button_pressed():
if Game.get_level().scene_file_path == \"res://level_1.tscn\":
Game.get_game_root().transition_to_level(\"res://level_2.tscn\", &\"slide_from_top\")
else:
Game.get_game_root().transition_to_level(\"res://level_1.tscn\", &\"fade_to_black\")
"
[node name="TestHud" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_sycoj")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 0
offset_left = 17.0
offset_top = 18.0
offset_right = 197.0
offset_bottom = 279.0
[node name="Label" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "Gamemode: %s"
[node name="SwitchGamemodeButton" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Switch Gamemode"
[node name="SwitchLevelButton" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Switch Level"
[connection signal="pressed" from="VBoxContainer/SwitchGamemodeButton" to="." method="_on_switch_gamemode_button_pressed"]
[connection signal="pressed" from="VBoxContainer/SwitchLevelButton" to="." method="_on_switch_level_button_pressed"]