Pause menu
This commit is contained in:
parent
614ee06c34
commit
abb03863b9
|
@ -0,0 +1,18 @@
|
|||
extends ColorRect
|
||||
|
||||
var paused = false setget set_paused
|
||||
|
||||
func set_paused(value):
|
||||
paused = value
|
||||
get_tree().paused = paused
|
||||
visible = paused
|
||||
|
||||
func _on_ResumeButton_pressed():
|
||||
self.paused = false
|
||||
|
||||
func _on_QuitButton_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
func _process(_delta):
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
self.paused = !paused
|
|
@ -0,0 +1,57 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/UI/DefaultTheme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://Scenes/Menus/PauseMenu.gd" type="Script" id=2]
|
||||
|
||||
[node name="PauseMenu" type="ColorRect"]
|
||||
pause_mode = 2
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 1 )
|
||||
color = Color( 0, 0, 0, 1 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
margin_left = 128.0
|
||||
margin_top = 54.0
|
||||
margin_right = 192.0
|
||||
margin_bottom = 125.0
|
||||
|
||||
[node name="PauseLabel" type="Label" parent="CenterContainer/VBoxContainer"]
|
||||
margin_right = 64.0
|
||||
margin_bottom = 15.0
|
||||
theme = ExtResource( 1 )
|
||||
text = "GAME PAUSED"
|
||||
align = 1
|
||||
|
||||
[node name="Gap" type="Control" parent="CenterContainer/VBoxContainer"]
|
||||
margin_top = 19.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 31.0
|
||||
rect_min_size = Vector2( 12, 12 )
|
||||
|
||||
[node name="ResumeButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
margin_top = 35.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 51.0
|
||||
rect_min_size = Vector2( 64, 16 )
|
||||
text = "Resume game"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
margin_top = 55.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 71.0
|
||||
rect_min_size = Vector2( 64, 16 )
|
||||
text = "Quit"
|
||||
[connection signal="pressed" from="CenterContainer/VBoxContainer/ResumeButton" to="." method="_on_ResumeButton_pressed"]
|
||||
[connection signal="pressed" from="CenterContainer/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"]
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/UI/HealthMeter.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Scenes/Menus/PauseMenu.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="UI" type="CanvasLayer"]
|
||||
|
||||
|
@ -9,3 +10,6 @@ margin_left = 4.0
|
|||
margin_top = 4.0
|
||||
margin_right = 25.0
|
||||
margin_bottom = 16.0
|
||||
|
||||
[node name="PauseMenu" parent="." instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
|
|
|
@ -98,6 +98,12 @@ fire={
|
|||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||
]
|
||||
}
|
||||
pause={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
Loading…
Reference in New Issue