Added pause menu
This commit is contained in:
parent
0971f2715f
commit
d977abbc26
@ -344,6 +344,52 @@ rotation = -0.445965
|
||||
theme_override_colors/default_color = Color(0.666667, 0, 0, 1)
|
||||
text = "Streak!"
|
||||
|
||||
[node name="Pause" type="Control" parent="UI"]
|
||||
process_mode = 2
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="UI/Pause"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -121.0
|
||||
offset_top = -73.0
|
||||
offset_right = 121.0
|
||||
offset_bottom = 73.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UI/Pause/PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="UI/Pause/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/normal_font_size = 30
|
||||
bbcode_enabled = true
|
||||
text = "[center]Paused[center]"
|
||||
fit_content = true
|
||||
|
||||
[node name="Control" type="Control" parent="UI/Pause/PanelContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 10)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Resume" type="Button" parent="UI/Pause/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Resume"
|
||||
|
||||
[node name="MainMenu" type="Button" parent="UI/Pause/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="Transitioner" type="ColorRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_lce0s")
|
||||
anchors_preset = 15
|
||||
@ -378,5 +424,7 @@ bus = &"Ambiance"
|
||||
[connection signal="timeout" from="UI/Timer" to="." method="_on_timer_timeout"]
|
||||
[connection signal="timeout" from="UI/Timer" to="UI" method="_on_timer_timeout"]
|
||||
[connection signal="pressed" from="UI/GameFinish/Back" to="." method="_on_back_pressed"]
|
||||
[connection signal="pressed" from="UI/Pause/PanelContainer/VBoxContainer/Resume" to="UI" method="togglePause"]
|
||||
[connection signal="pressed" from="UI/Pause/PanelContainer/VBoxContainer/MainMenu" to="." method="_on_back_pressed"]
|
||||
[connection signal="finished" from="Wind/Slow" to="Wind" method="_on_slow_finished"]
|
||||
[connection signal="finished" from="Wind/Fast" to="Wind" method="_on_fast_finished"]
|
||||
|
@ -114,6 +114,7 @@ func pickHouse() -> void:
|
||||
delivery.position = Vector3(-cellSize / 3 + column * cellSize * 2 / 3, 50, ((rowIndex + blocksAhead) * -cellSize) - cellSize / 2)
|
||||
|
||||
func _on_back_pressed() -> void:
|
||||
get_tree().paused = false
|
||||
get_tree().root.add_child(load("res://Scenes/UI/MainMenu.tscn").instantiate())
|
||||
instance = null
|
||||
moving = true
|
||||
|
@ -9,6 +9,7 @@ static var instance: UI
|
||||
@onready var compassText: RichTextLabel = $Compass/RichTextLabel
|
||||
@onready var streak: Control = $Streak
|
||||
@onready var streakCount: RichTextLabel = $Streak/Count
|
||||
@onready var pauseMenu: Control = $Pause
|
||||
|
||||
var tween: Tween
|
||||
|
||||
@ -36,6 +37,12 @@ func _process(delta: float) -> void:
|
||||
compassArrow.flip_h = false
|
||||
else:
|
||||
compassArrow.flip_h = true
|
||||
if (Input.is_action_just_released("pause")):
|
||||
togglePause()
|
||||
|
||||
func togglePause() -> void:
|
||||
pauseMenu.visible = !pauseMenu.visible
|
||||
get_tree().paused = !get_tree().paused
|
||||
|
||||
func showTitle(text: String) -> void:
|
||||
announcement.text = "[center]%s[/center]" % text
|
||||
|
File diff suppressed because one or more lines are too long
@ -70,6 +70,11 @@ leftclick={
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(140, 16),"global_position":Vector2(149, 62),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
pause={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user