Pause
This commit is contained in:
parent
afd9e990f1
commit
30266b36cf
11 changed files with 253 additions and 22 deletions
BIN
assets/audio/zo.mp3
Normal file
BIN
assets/audio/zo.mp3
Normal file
Binary file not shown.
19
assets/audio/zo.mp3.import
Normal file
19
assets/audio/zo.mp3.import
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://co33ajpc1a1qm"
|
||||
path="res://.godot/imported/zo.mp3-b49195c3f7b09ef9bafc298a44270219.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/zo.mp3"
|
||||
dest_files=["res://.godot/imported/zo.mp3-b49195c3f7b09ef9bafc298a44270219.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
[gd_resource type="Theme" load_steps=6 format=3 uid="uid://b8l285cjcgeyi"]
|
||||
[gd_resource type="Theme" load_steps=9 format=3 uid="uid://b8l285cjcgeyi"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://nbrt5q3t8tud" path="res://assets/fonts/pico12.ttf" id="1_103to"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0yhee0scl7mc" path="res://assets/sprites/gui/ButtonBackground.tres" id="1_y0kbp"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxmg20mrnpt8r" path="res://assets/sprites/gui/SelectionGeneric.tres" id="2_h0nd2"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5skdm3q7tkh3" path="res://assets/sprites/gui/ChooseYourSeeds/Grabber.tres" id="3_i6w8j"]
|
||||
[ext_resource type="Texture2D" uid="uid://cv255d4s0qopj" path="res://assets/sprites/gui/ChooseYourSeeds/Slider.tres" id="4_yeah5"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_na4u2"]
|
||||
texture = ExtResource("1_y0kbp")
|
||||
|
|
@ -21,6 +23,13 @@ axis_stretch_horizontal = 1
|
|||
axis_stretch_vertical = 1
|
||||
draw_center = false
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_5pe7g"]
|
||||
texture = ExtResource("4_yeah5")
|
||||
texture_margin_left = 5.0
|
||||
texture_margin_top = 5.0
|
||||
texture_margin_right = 5.0
|
||||
texture_margin_bottom = 5.0
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource("1_103to")
|
||||
Button/colors/font_color = Color(0, 0, 0, 1)
|
||||
|
|
@ -32,3 +41,9 @@ Button/styles/focus = SubResource("StyleBoxTexture_mv7jy")
|
|||
Button/styles/hover = SubResource("StyleBoxTexture_na4u2")
|
||||
Button/styles/normal = SubResource("StyleBoxTexture_na4u2")
|
||||
Button/styles/pressed = SubResource("StyleBoxTexture_na4u2")
|
||||
VSlider/icons/grabber = ExtResource("3_i6w8j")
|
||||
VSlider/icons/grabber_disabled = ExtResource("3_i6w8j")
|
||||
VSlider/icons/grabber_highlight = ExtResource("3_i6w8j")
|
||||
VSlider/styles/grabber_area = SubResource("StyleBoxTexture_5pe7g")
|
||||
VSlider/styles/grabber_area_highlight = SubResource("StyleBoxTexture_5pe7g")
|
||||
VSlider/styles/slider = SubResource("StyleBoxTexture_5pe7g")
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ _armor = NodePath("Armor")
|
|||
material = SubResource("ShaderMaterial_sat5k")
|
||||
|
||||
[node name="Hat" type="RigidBody2D" parent="CanvasGroup" index="1" node_paths=PackedStringArray("data", "deathTimer")]
|
||||
position = Vector2(-12, -78)
|
||||
position = Vector2(-9, -76)
|
||||
collision_layer = 128
|
||||
collision_mask = 64
|
||||
mass = 0.5
|
||||
|
|
@ -47,11 +47,11 @@ data = NodePath("../..")
|
|||
deathTimer = NodePath("Timer")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="CanvasGroup/Hat" index="0"]
|
||||
position = Vector2(2, -10)
|
||||
position = Vector2(-1, -12)
|
||||
texture = ExtResource("4_qdhik")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CanvasGroup/Hat" index="1"]
|
||||
position = Vector2(4, -4)
|
||||
position = Vector2(1, -6)
|
||||
shape = SubResource("CircleShape2D_67t4t")
|
||||
|
||||
[node name="Timer" type="Timer" parent="CanvasGroup/Hat" index="2"]
|
||||
|
|
|
|||
163
scenes/gui/pause.tscn
Normal file
163
scenes/gui/pause.tscn
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://c1ctn2bvt4cpq"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_4k24j"]
|
||||
[ext_resource type="Script" uid="uid://gvwhpjoame6m" path="res://scripts/components/gui/PauseMenu.cs" id="2_tifvb"]
|
||||
[ext_resource type="AudioStream" uid="uid://co33ajpc1a1qm" path="res://assets/audio/zo.mp3" id="3_or0he"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tifvb"]
|
||||
atlas = ExtResource("1_4k24j")
|
||||
region = Rect2(0, 0, 177, 174)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jd4l2"]
|
||||
atlas = ExtResource("1_4k24j")
|
||||
region = Rect2(177, 0, 42, 40)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_or0he"]
|
||||
font_size = 32
|
||||
outline_size = 2
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4k24j"]
|
||||
atlas = ExtResource("1_4k24j")
|
||||
region = Rect2(0, 221, 127, 20)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_or0he"]
|
||||
atlas = ExtResource("1_4k24j")
|
||||
region = Rect2(255, 221, 118, 20)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_y3stn"]
|
||||
atlas = ExtResource("1_4k24j")
|
||||
region = Rect2(194, 221, 61, 20)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2swbg"]
|
||||
resource_name = "main"
|
||||
length = 10.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Flower:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 5, 10),
|
||||
"transitions": PackedFloat32Array(-2, -2, -2),
|
||||
"update": 0,
|
||||
"values": [Vector2(110, 7), Vector2(110, 7), Vector2(110, 7)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Flower:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 5, 10),
|
||||
"transitions": PackedFloat32Array(-2, -2, -2),
|
||||
"update": 0,
|
||||
"values": [-0.352319, 0.330185, -0.352319]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_miax1"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Flower:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(110, 7)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Flower:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [-0.352319]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ksc54"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_miax1"),
|
||||
&"main": SubResource("Animation_2swbg")
|
||||
}
|
||||
|
||||
[node name="Pause" type="NinePatchRect"]
|
||||
process_mode = 3
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.318333
|
||||
anchor_top = 0.185
|
||||
anchor_right = 0.755
|
||||
anchor_bottom = 0.8325
|
||||
texture = SubResource("AtlasTexture_tifvb")
|
||||
patch_margin_left = 73
|
||||
patch_margin_top = 98
|
||||
patch_margin_right = 73
|
||||
patch_margin_bottom = 52
|
||||
script = ExtResource("2_tifvb")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Flower" type="TextureRect" parent="."]
|
||||
z_index = -1
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.419848
|
||||
anchor_top = 0.027027
|
||||
anchor_right = 0.580153
|
||||
anchor_bottom = 0.181467
|
||||
rotation = -0.352319
|
||||
pivot_offset = Vector2(21, 39)
|
||||
texture = SubResource("AtlasTexture_jd4l2")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 58.0002
|
||||
offset_top = 69.0
|
||||
offset_right = 209.0
|
||||
offset_bottom = 246.0
|
||||
|
||||
[node name="Buttons" type="VBoxContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PAUSED" type="Label" parent="HBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
text = "PAUSED"
|
||||
label_settings = SubResource("LabelSettings_or0he")
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="ContinueButton" type="Button" parent="HBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
icon = SubResource("AtlasTexture_4k24j")
|
||||
|
||||
[node name="RestartButton" type="Button" parent="HBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
icon = SubResource("AtlasTexture_or0he")
|
||||
icon_alignment = 1
|
||||
|
||||
[node name="ExitButton" type="Button" parent="HBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
icon = SubResource("AtlasTexture_y3stn")
|
||||
icon_alignment = 1
|
||||
|
||||
[node name="Audio" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_or0he")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_ksc54")
|
||||
}
|
||||
autoplay = "main"
|
||||
|
||||
[connection signal="pressed" from="HBoxContainer/Buttons/ContinueButton" to="." method="Continue"]
|
||||
[connection signal="pressed" from="HBoxContainer/Buttons/RestartButton" to="." method="Restart"]
|
||||
[connection signal="pressed" from="HBoxContainer/Buttons/ExitButton" to="." method="Exit"]
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://u5l3jd00s8vd"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://u5l3jd00s8vd"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dm0hjd67a6mva" path="res://assets/sprites/gui/Pause.tres" id="1_7k3tg"]
|
||||
[ext_resource type="Script" uid="uid://cmfhiun6yrlr6" path="res://scripts/components/gui/PauseButton.cs" id="2_01o3l"]
|
||||
|
||||
[node name="PauseButton" type="Button"]
|
||||
anchors_preset = -1
|
||||
|
|
@ -10,3 +11,4 @@ offset_right = 0.199999
|
|||
size_flags_vertical = 4
|
||||
mouse_default_cursor_shape = 2
|
||||
icon = ExtResource("1_7k3tg")
|
||||
script = ExtResource("2_01o3l")
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://devn21c7luf45" path="res://scenes/level components/field_controller.tscn" id="4_ibntj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfnmspei3k4p7" path="res://scenes/gui/runtime_gui.tscn" id="5_iotae"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpxxjfd5lv5sv" path="res://scenes/gui/choose_your_seeds.tscn" id="6_btfw3"]
|
||||
[ext_resource type="PackedScene" uid="uid://c1ctn2bvt4cpq" path="res://scenes/gui/pause.tscn" id="7_3ghv7"]
|
||||
[ext_resource type="Script" uid="uid://cslqjdd5wq4rc" path="res://scripts/components/level/SunSpawner.cs" id="7_gnb05"]
|
||||
[ext_resource type="PackedScene" uid="uid://bpekho7leatr5" path="res://scenes/sun.tscn" id="8_8nyym"]
|
||||
[ext_resource type="Script" uid="uid://bsuw5lvnr3kol" path="res://scripts/components/level/zombe_spawners/ZombieSequencer.cs" id="9_8nyym"]
|
||||
|
|
@ -14,15 +15,6 @@
|
|||
[ext_resource type="PackedScene" uid="uid://plc2gus4ppds" path="res://scenes/level components/left_boundary_marker.tscn" id="10_5h8lk"]
|
||||
[ext_resource type="Script" uid="uid://blpu7t8tf6277" path="res://scripts/components/particles/FallFloor.cs" id="13_5h8lk"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_1kjp6"]
|
||||
resource_name = "zombiePoints"
|
||||
script/source = "extends Label
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
text = str(get_node(\"../SurvivalAI\").get(\"points\")) + \"\\n\" + str(get_node(\"../SurvivalAI\").time)
|
||||
"
|
||||
|
||||
[sub_resource type="Curve" id="Curve_1kjp6"]
|
||||
_limits = [0.0, 5.0, 0.0, 2000.0]
|
||||
_data = [Vector2(0, 0), 0.0, 0.000634783, 0, 0, Vector2(19.8456, 0.0978518), 0.0, 0.0, 0, 0, Vector2(114.664, 0.12832), 0.0, 0.0, 0, 0, Vector2(213.892, 0.465625), 0.0017272, 0.00230293, 0, 0, Vector2(1499.45, 2.99414), 0.0, 0.00350837, 0, 0, Vector2(2000, 5), 0.00737658, 0.0, 0, 0]
|
||||
|
|
@ -41,14 +33,6 @@ position = Vector2(500, 200)
|
|||
texture = ExtResource("1_vafkg")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
z_index = 3465
|
||||
offset_left = 678.0
|
||||
offset_top = 362.0
|
||||
offset_right = 718.0
|
||||
offset_bottom = 379.0
|
||||
script = SubResource("GDScript_1kjp6")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2(481, 200)
|
||||
metadata/_edit_lock_ = true
|
||||
|
|
@ -91,6 +75,9 @@ metadata/_edit_lock_ = true
|
|||
[node name="ChooseYourSeeds" parent="GUI" instance=ExtResource("6_btfw3")]
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Pause" parent="GUI" instance=ExtResource("7_3ghv7")]
|
||||
visible = false
|
||||
|
||||
[node name="SunSpawner" type="Node" parent="."]
|
||||
script = ExtResource("7_gnb05")
|
||||
SunScene = ExtResource("8_8nyym")
|
||||
|
|
|
|||
11
scripts/components/gui/PauseButton.cs
Normal file
11
scripts/components/gui/PauseButton.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PauseButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
PauseMenu.Pause();
|
||||
}
|
||||
|
||||
}
|
||||
1
scripts/components/gui/PauseButton.cs.uid
Normal file
1
scripts/components/gui/PauseButton.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cmfhiun6yrlr6
|
||||
32
scripts/components/gui/PauseMenu.cs
Normal file
32
scripts/components/gui/PauseMenu.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PauseMenu : Control
|
||||
{
|
||||
private static PauseMenu Instance;
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void Continue()
|
||||
{
|
||||
Visible = false;
|
||||
GetTree().Paused = false;
|
||||
}
|
||||
public void Restart()
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
GetTree().ReloadCurrentScene();
|
||||
}
|
||||
public void Exit()
|
||||
{
|
||||
GetNode<AudioStreamPlayer>("Audio").Play();
|
||||
GetNode<AudioStreamPlayer>("Audio").Finished += () => { GetTree().Quit(); };
|
||||
}
|
||||
public static void Pause()
|
||||
{
|
||||
Instance.Visible = true;
|
||||
Instance.GetTree().Paused = true;
|
||||
}
|
||||
}
|
||||
1
scripts/components/gui/PauseMenu.cs.uid
Normal file
1
scripts/components/gui/PauseMenu.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://gvwhpjoame6m
|
||||
Loading…
Add table
Add a link
Reference in a new issue