Pause Screen

Added the old pause screen overlay to the Player scene, dialogic functionality not yet smoothed out
This commit is contained in:
vengefulcartographer 2022-12-20 12:16:37 -07:00
parent fd50b67fa8
commit b5df884dcb
5 changed files with 119 additions and 5 deletions

View File

@ -23,7 +23,7 @@
}, },
{ {
"id": "1667703692-648", "id": "1667703692-648",
"name": "Seen Intro", "name": "seen intro",
"type": 0, "type": 0,
"value": "false" "value": "false"
} }

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=28 format=2] [gd_scene load_steps=29 format=2]
[ext_resource path="res://player/CameraController.gd" type="Script" id=1] [ext_resource path="res://player/CameraController.gd" type="Script" id=1]
[ext_resource path="res://player/OnFootPhysics.gd" type="Script" id=2] [ext_resource path="res://player/OnFootPhysics.gd" type="Script" id=2]
@ -19,6 +19,7 @@
[ext_resource path="res://assets/FootstepSfx/Steps_water-003.ogg" type="AudioStream" id=17] [ext_resource path="res://assets/FootstepSfx/Steps_water-003.ogg" type="AudioStream" id=17]
[ext_resource path="res://assets/audio/404327__pfranzen__male-grunts-and-groans.ogg" type="AudioStream" id=18] [ext_resource path="res://assets/audio/404327__pfranzen__male-grunts-and-groans.ogg" type="AudioStream" id=18]
[ext_resource path="res://effects/player/MovementSoundsAnimations.gd" type="Script" id=19] [ext_resource path="res://effects/player/MovementSoundsAnimations.gd" type="Script" id=19]
[ext_resource path="res://screens/PauseScreen.tscn" type="PackedScene" id=20]
[sub_resource type="Animation" id=8] [sub_resource type="Animation" id=8]
length = 0.001 length = 0.001
@ -251,6 +252,8 @@ stretch_mode = 1
anims/RESET = SubResource( 6 ) anims/RESET = SubResource( 6 )
anims/opacity = SubResource( 7 ) anims/opacity = SubResource( 7 )
[node name="PauseScreen" parent="Overlay" instance=ExtResource( 20 )]
[connection signal="area_entered" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_entered"] [connection signal="area_entered" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_entered"]
[connection signal="area_exited" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_exited"] [connection signal="area_exited" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_exited"]
[connection signal="timeout" from="MovementInput/VerticalTimer" to="MovementInput" method="_on_VerticalTimer_timeout"] [connection signal="timeout" from="MovementInput/VerticalTimer" to="MovementInput" method="_on_VerticalTimer_timeout"]

View File

@ -0,0 +1,40 @@
extends Control
var is_paused = false setget set_is_paused
func _ready():
visible = false
func _unhandled_input(event):
if event.is_action_pressed("pause"):
self.is_paused = !is_paused
func set_is_paused(value):
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
is_paused = value
get_tree().paused = is_paused
visible = is_paused
if is_paused:
$CenterContainer/VBoxContainer/ResumeButton.grab_focus()
func _on_QuitButton_pressed():
get_tree().quit()
func _on_ResumeButton_pressed():
get_tree().paused = false
visible = false
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _on_MainMenuButton_pressed():
get_tree().paused = false
var _a = get_tree().change_scene("res://Screens/TitleScreen.tscn")
func _on_ControlsButton_pressed():
var dialog = Dialogic.start("controls")
add_child(dialog)
dialog.connect("tree_exiting", self, "controls_done")
func controls_done():
$CenterContainer/VBoxContainer/ControlsButton.grab_focus()

View File

@ -0,0 +1,73 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/blackbackground.png" type="Texture" id=1]
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=2]
[ext_resource path="res://Screens/PauseScreen.gd" type="Script" id=3]
[node name="PauseScreen" type="Control"]
pause_mode = 2
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 3 )
[node name="pauseBackground" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
stretch_mode = 1
[node name="CenterContainer" type="CenterContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
margin_left = 312.0
margin_top = 146.0
margin_right = 712.0
margin_bottom = 454.0
theme = ExtResource( 2 )
custom_constants/separation = 10
[node name="Label" type="Label" parent="CenterContainer/VBoxContainer"]
margin_right = 400.0
margin_bottom = 36.0
text = "Paused"
align = 1
[node name="Spacer" type="Control" parent="CenterContainer/VBoxContainer"]
margin_top = 46.0
margin_right = 400.0
margin_bottom = 76.0
rect_min_size = Vector2( 1, 30 )
[node name="ResumeButton" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 86.0
margin_right = 400.0
margin_bottom = 136.0
rect_min_size = Vector2( 400, 50 )
text = "Resume"
[node name="MainMenuButton" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 146.0
margin_right = 400.0
margin_bottom = 196.0
rect_min_size = Vector2( 400, 50 )
text = "Main Menu"
[node name="ControlsButton" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 206.0
margin_right = 400.0
margin_bottom = 248.0
text = "Controls"
[node name="QuitButton" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 258.0
margin_right = 400.0
margin_bottom = 308.0
rect_min_size = Vector2( 400, 50 )
text = "Quit"
[connection signal="pressed" from="CenterContainer/VBoxContainer/ResumeButton" to="." method="_on_ResumeButton_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/MainMenuButton" to="." method="_on_MainMenuButton_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/ControlsButton" to="." method="_on_ControlsButton_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"]

File diff suppressed because one or more lines are too long