Refactor scene structure and resource paths; add death and game over screens
This commit is contained in:
@@ -6,4 +6,5 @@
|
|||||||
|
|
||||||
[node name="Background Music" type="AudioStreamPlayer" parent="."]
|
[node name="Background Music" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource("1_fuc3i")
|
stream = ExtResource("1_fuc3i")
|
||||||
|
autoplay = true
|
||||||
parameters/looping = true
|
parameters/looping = true
|
||||||
|
@@ -1,12 +1,8 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://dtjrpkhssq32a"]
|
[gd_scene load_steps=4 format=3 uid="uid://dtjrpkhssq32a"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://t7mulx3226o0" path="res://sprites/backgrounds/Background_2.png" id="1_w23vv"]
|
[ext_resource type="Texture2D" uid="uid://t7mulx3226o0" path="res://sprites/backgrounds/Background_2.png" id="1_w23vv"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c7i1ariim7idx" path="res://sprites/backgrounds/Background_1.png" id="2_pm10e"]
|
[ext_resource type="Texture2D" uid="uid://c7i1ariim7idx" path="res://sprites/backgrounds/Background_1.png" id="2_pm10e"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bnsghs5y3pw5s" path="res://sprites/backgrounds/8.png" id="3_cvs3x"]
|
[ext_resource type="Texture2D" uid="uid://bnsghs5y3pw5s" path="res://sprites/backgrounds/8.png" id="3_cvs3x"]
|
||||||
[ext_resource type="Texture2D" uid="uid://tk2bj7w1jxgj" path="res://sprites/backgrounds/background1.png" id="4_4j3tt"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dwxbabw207t3r" path="res://sprites/backgrounds/background2.png" id="5_mgjfj"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://j0d5cqrrftjj" path="res://sprites/backgrounds/background3.png" id="6_le8kl"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cj2yaw03r4q82" path="res://sprites/backgrounds/background4a.png" id="7_nkaxn"]
|
|
||||||
|
|
||||||
[node name="BG" type="Node2D"]
|
[node name="BG" type="Node2D"]
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
@@ -20,23 +16,3 @@ texture = ExtResource("2_pm10e")
|
|||||||
[node name="8" type="Sprite2D" parent="."]
|
[node name="8" type="Sprite2D" parent="."]
|
||||||
position = Vector2(-30, -25)
|
position = Vector2(-30, -25)
|
||||||
texture = ExtResource("3_cvs3x")
|
texture = ExtResource("3_cvs3x")
|
||||||
|
|
||||||
[node name="Background1" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
position = Vector2(14, 335)
|
|
||||||
texture = ExtResource("4_4j3tt")
|
|
||||||
|
|
||||||
[node name="Background2" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
position = Vector2(14, 335)
|
|
||||||
texture = ExtResource("5_mgjfj")
|
|
||||||
|
|
||||||
[node name="Background3" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
position = Vector2(10, 355)
|
|
||||||
texture = ExtResource("6_le8kl")
|
|
||||||
|
|
||||||
[node name="Background4a" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
position = Vector2(10, 355)
|
|
||||||
texture = ExtResource("7_nkaxn")
|
|
||||||
|
40
objects/parallax_background.tscn
Normal file
40
objects/parallax_background.tscn
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://bva54p1fxomu2"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d2f4ooucvrjcc" path="res://sprites/backgrounds/plains/1.png" id="1_rfutu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cdgk3fi8owc6o" path="res://sprites/backgrounds/plains/2.png" id="2_uysv2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://p0bt2k2lihlx" path="res://sprites/backgrounds/plains/3.png" id="3_l6n33"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bcahm7wqdbn6n" path="res://sprites/backgrounds/plains/4.png" id="4_jkhju"]
|
||||||
|
|
||||||
|
[node name="ParallaxBackground" type="ParallaxBackground"]
|
||||||
|
|
||||||
|
[node name="Sky" type="ParallaxLayer" parent="."]
|
||||||
|
motion_scale = Vector2(0, 0)
|
||||||
|
motion_mirroring = Vector2(480, 0)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Sky"]
|
||||||
|
texture = ExtResource("1_rfutu")
|
||||||
|
centered = false
|
||||||
|
|
||||||
|
[node name="Clouds" type="ParallaxLayer" parent="."]
|
||||||
|
motion_scale = Vector2(0.1, 0.1)
|
||||||
|
motion_mirroring = Vector2(480, 0)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Clouds"]
|
||||||
|
texture = ExtResource("2_uysv2")
|
||||||
|
centered = false
|
||||||
|
|
||||||
|
[node name="Hills" type="ParallaxLayer" parent="."]
|
||||||
|
motion_scale = Vector2(0.2, 0.2)
|
||||||
|
motion_mirroring = Vector2(480, 0)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Hills"]
|
||||||
|
texture = ExtResource("3_l6n33")
|
||||||
|
centered = false
|
||||||
|
|
||||||
|
[node name="Ground" type="ParallaxLayer" parent="."]
|
||||||
|
motion_scale = Vector2(0.3, 0.3)
|
||||||
|
motion_mirroring = Vector2(480, 0)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Ground"]
|
||||||
|
texture = ExtResource("4_jkhju")
|
||||||
|
centered = false
|
@@ -1,17 +1,22 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://dulkm3ah4tm0u"]
|
[gd_scene load_steps=4 format=3 uid="uid://dulkm3ah4tm0u"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://b3d1p21sviww4" path="res://scripts/ui/death_screen.gd" id="1_eaoak"]
|
||||||
[ext_resource type="Texture2D" uid="uid://jix7wdn0isr3" path="res://sprites/ppc_icon.png" id="1_m30em"]
|
[ext_resource type="Texture2D" uid="uid://jix7wdn0isr3" path="res://sprites/ppc_icon.png" id="1_m30em"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eaoak"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eaoak"]
|
||||||
bg_color = Color(0, 0, 0, 1)
|
bg_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="DeathScreen" type="Control"]
|
[node name="DeathScreen" type="Control" node_paths=PackedStringArray("death_screen_root", "current_level_label", "lives_left_label")]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_eaoak")
|
||||||
|
death_screen_root = NodePath(".")
|
||||||
|
current_level_label = NodePath("PanelContainer/MarginContainer/VBoxContainer/LevelName")
|
||||||
|
lives_left_label = NodePath("PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/LivesLeft")
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@@ -1,15 +1,21 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://wmw6gaisyrvx"]
|
[gd_scene load_steps=3 format=3 uid="uid://wmw6gaisyrvx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bkd7o2u4psu4p" path="res://scripts/ui/game_over_screen.gd" id="1_v1o0m"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mtg1b"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mtg1b"]
|
||||||
bg_color = Color(0, 0, 0, 1)
|
bg_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="GameOverScreen" type="Control"]
|
[node name="GameOverScreen" type="Control" node_paths=PackedStringArray("game_over_screen", "restart_button", "main_menu_button")]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_v1o0m")
|
||||||
|
game_over_screen = NodePath(".")
|
||||||
|
restart_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/RestartLevelButton")
|
||||||
|
main_menu_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/MenuButton")
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://byxf45ukq82pe"]
|
[gd_scene load_steps=8 format=3 uid="uid://byxf45ukq82pe"]
|
||||||
|
|
||||||
[ext_resource type="LabelSettings" uid="uid://rvn5ivivfvv6" path="res://resources/ui/hud_label_settings.tres" id="1_4dsh5"]
|
[ext_resource type="LabelSettings" uid="uid://rvn5ivivfvv6" path="res://resources/ui/hud_label_settings.tres" id="1_4dsh5"]
|
||||||
[ext_resource type="Script" uid="uid://c3pde84b3kdco" path="res://scripts/hud.gd" id="1_ueofj"]
|
[ext_resource type="Script" uid="uid://c3pde84b3kdco" path="res://scripts/ui/hud.gd" id="1_ueofj"]
|
||||||
[ext_resource type="FontFile" uid="uid://xm0vbusjr7b7" path="res://fonts/PressStart2P-Regular.ttf" id="1_ygmwt"]
|
[ext_resource type="FontFile" uid="uid://xm0vbusjr7b7" path="res://fonts/PressStart2P-Regular.ttf" id="1_ygmwt"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mmcdi"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mmcdi"]
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://cvfsbiy5ggrpg"]
|
[gd_scene load_steps=4 format=3 uid="uid://cvfsbiy5ggrpg"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bxpr4m7lq7clh" path="res://objects/ui/input_button.tscn" id="1_h8s4o"]
|
[ext_resource type="PackedScene" uid="uid://bxpr4m7lq7clh" path="res://objects/ui/input_button.tscn" id="1_h8s4o"]
|
||||||
[ext_resource type="Script" uid="uid://dppwl7xie2mh" path="res://scripts/input_settings.gd" id="1_v2gus"]
|
[ext_resource type="Script" uid="uid://dppwl7xie2mh" path="res://scripts/ui/input_settings.gd" id="1_v2gus"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_se25o"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_se25o"]
|
||||||
bg_color = Color(0, 0, 0, 1)
|
bg_color = Color(0, 0, 0, 1)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=11 format=3 uid="uid://dlm2ri562fynd"]
|
[gd_scene load_steps=11 format=3 uid="uid://dlm2ri562fynd"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://duifmqjarjpuv" path="res://scripts/marketplace.gd" id="1_ncpyg"]
|
[ext_resource type="Script" uid="uid://duifmqjarjpuv" path="res://scripts/ui/marketplace.gd" id="1_ncpyg"]
|
||||||
[ext_resource type="FontFile" uid="uid://xm0vbusjr7b7" path="res://fonts/PressStart2P-Regular.ttf" id="2_ho1tm"]
|
[ext_resource type="FontFile" uid="uid://xm0vbusjr7b7" path="res://fonts/PressStart2P-Regular.ttf" id="2_ho1tm"]
|
||||||
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="2_pg4mc"]
|
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="2_pg4mc"]
|
||||||
[ext_resource type="Resource" uid="uid://dw5ee2lpeypnb" path="res://resources/skills/brick_throw.tres" id="3_bk5yi"]
|
[ext_resource type="Resource" uid="uid://dw5ee2lpeypnb" path="res://resources/skills/brick_throw.tres" id="3_bk5yi"]
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://i6mnjbjcoqe5"]
|
[gd_scene load_steps=3 format=3 uid="uid://i6mnjbjcoqe5"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cugifchx6jhuk" path="res://scripts/pause_menu.gd" id="1_aktha"]
|
[ext_resource type="Script" uid="uid://cugifchx6jhuk" path="res://scripts/ui/pause_menu.gd" id="1_aktha"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g4ivv"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g4ivv"]
|
||||||
bg_color = Color(0, 0, 0, 1)
|
bg_color = Color(0, 0, 0, 1)
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://y0ae6e7t70fj"]
|
[gd_scene load_steps=3 format=3 uid="uid://y0ae6e7t70fj"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c506rigcjlm6x" path="res://scripts/settings_menu.gd" id="1_lt6q2"]
|
[ext_resource type="Script" uid="uid://c506rigcjlm6x" path="res://scripts/ui/settings_menu.gd" id="1_lt6q2"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wgbcl"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wgbcl"]
|
||||||
bg_color = Color(0, 0, 0, 1)
|
bg_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="Settings menu" type="Control" node_paths=PackedStringArray("settings_menu_control")]
|
[node name="Settings menu" type="Control" node_paths=PackedStringArray("settings_menu_control", "input_settings_button", "audio_settings_button", "display_settings_button", "gameplay_settings_button")]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -14,6 +14,10 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("1_lt6q2")
|
script = ExtResource("1_lt6q2")
|
||||||
settings_menu_control = NodePath(".")
|
settings_menu_control = NodePath(".")
|
||||||
|
input_settings_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Input Settings Button")
|
||||||
|
audio_settings_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Audio Settings Button")
|
||||||
|
display_settings_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Display Settings Button")
|
||||||
|
gameplay_settings_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Gameplay Settings Button")
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@@ -43,7 +43,6 @@ file_logging/enable_file_logging=true
|
|||||||
|
|
||||||
window/size/viewport_width=480
|
window/size/viewport_width=480
|
||||||
window/size/viewport_height=270
|
window/size/viewport_height=270
|
||||||
window/size/mode=4
|
|
||||||
window/size/initial_position=Vector2i(400, 100)
|
window/size/initial_position=Vector2i(400, 100)
|
||||||
window/size/window_width_override=1440
|
window/size/window_width_override=1440
|
||||||
window/size/window_height_override=810
|
window/size/window_height_override=810
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -7,10 +7,6 @@ extends Node2D
|
|||||||
@onready var gm: GM = $"/root/GameManager"
|
@onready var gm: GM = $"/root/GameManager"
|
||||||
|
|
||||||
|
|
||||||
func reset_scene() -> void:
|
|
||||||
get_tree().reload_current_scene()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_health_component_on_death() -> void:
|
func _on_health_component_on_death() -> void:
|
||||||
if death_sfx:
|
if death_sfx:
|
||||||
death_sfx.play()
|
death_sfx.play()
|
||||||
@@ -20,10 +16,6 @@ func _on_health_component_on_death() -> void:
|
|||||||
effect.global_position = global_position
|
effect.global_position = global_position
|
||||||
effect.scale = Vector2(1.5, 1.5)
|
effect.scale = Vector2(1.5, 1.5)
|
||||||
|
|
||||||
if gm.get_lives() == 1:
|
gm.remove_lives(1)
|
||||||
gm.reset_player_state()
|
gm.set_coins(0)
|
||||||
else:
|
|
||||||
gm.remove_lives(1)
|
|
||||||
gm.set_coins(0)
|
|
||||||
|
|
||||||
call_deferred("reset_scene")
|
|
||||||
|
5
scripts/resources/level_resource.gd
Normal file
5
scripts/resources/level_resource.gd
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class_name LevelResource
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
@export var level_name: String
|
||||||
|
@export var scene_path: PackedScene
|
1
scripts/resources/level_resource.gd.uid
Normal file
1
scripts/resources/level_resource.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cp68km8bykymb
|
@@ -1,8 +0,0 @@
|
|||||||
class_name SettingsMenu
|
|
||||||
extends Node
|
|
||||||
|
|
||||||
@export var input_settings_scene: PackedScene = preload("res://objects/ui/input_settings.tscn")
|
|
||||||
@export var audio_settings_scene: PackedScene
|
|
||||||
@export var display_settings_scene: PackedScene
|
|
||||||
@export var gameplay_settings_scene: PackedScene
|
|
||||||
@export var settings_menu_control: Control
|
|
62
scripts/ui/death_screen.gd
Normal file
62
scripts/ui/death_screen.gd
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
class_name DeathScreen
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var death_screen_root: Control
|
||||||
|
@export var current_level: LevelResource
|
||||||
|
@export var current_level_label: Label
|
||||||
|
@export var lives_left_label: Label
|
||||||
|
@export var timeout_time: float = 2.0
|
||||||
|
@export var nodes_to_disable: Array[Node] = []
|
||||||
|
|
||||||
|
@onready var gm: GM = $"/root/GameManager"
|
||||||
|
|
||||||
|
var timer: Timer
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
set_lables()
|
||||||
|
|
||||||
|
|
||||||
|
func set_lables() -> void:
|
||||||
|
if not gm:
|
||||||
|
return
|
||||||
|
|
||||||
|
current_level_label.text = current_level.level_name
|
||||||
|
lives_left_label.text = " x " + str(gm.get_lives())
|
||||||
|
|
||||||
|
|
||||||
|
func setup_timer() -> void:
|
||||||
|
timer = Timer.new()
|
||||||
|
timer.wait_time = timeout_time
|
||||||
|
timer.one_shot = true
|
||||||
|
timer.timeout.connect(on_timeout)
|
||||||
|
add_child(timer)
|
||||||
|
timer.start()
|
||||||
|
|
||||||
|
|
||||||
|
func toggle_nodes() -> void:
|
||||||
|
for node in nodes_to_disable:
|
||||||
|
if node.process_mode == PROCESS_MODE_DISABLED:
|
||||||
|
node.process_mode = PROCESS_MODE_INHERIT
|
||||||
|
else:
|
||||||
|
node.process_mode = PROCESS_MODE_DISABLED
|
||||||
|
|
||||||
|
|
||||||
|
func on_player_death() -> void:
|
||||||
|
if not gm:
|
||||||
|
return
|
||||||
|
|
||||||
|
toggle_nodes()
|
||||||
|
set_lables()
|
||||||
|
death_screen_root.show()
|
||||||
|
setup_timer()
|
||||||
|
|
||||||
|
|
||||||
|
func on_timeout() -> void:
|
||||||
|
if not gm:
|
||||||
|
return
|
||||||
|
|
||||||
|
if gm.get_lives() == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
get_tree().reload_current_scene()
|
1
scripts/ui/death_screen.gd.uid
Normal file
1
scripts/ui/death_screen.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b3d1p21sviww4
|
41
scripts/ui/game_over_screen.gd
Normal file
41
scripts/ui/game_over_screen.gd
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
class_name GameOverScreen
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var game_over_screen: Control
|
||||||
|
@export var restart_button: Button
|
||||||
|
@export var main_menu_button: Button
|
||||||
|
@export var main_menu_scene: PackedScene
|
||||||
|
|
||||||
|
@onready var gm: GM = $"/root/GameManager"
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if not gm:
|
||||||
|
return
|
||||||
|
|
||||||
|
game_over_screen.hide()
|
||||||
|
restart_button.pressed.connect(on_restart_button_pressed)
|
||||||
|
main_menu_button.pressed.connect(on_main_menu_button_pressed)
|
||||||
|
|
||||||
|
|
||||||
|
func on_restart_button_pressed() -> void:
|
||||||
|
if not gm:
|
||||||
|
return
|
||||||
|
|
||||||
|
gm.reset_player_state()
|
||||||
|
get_tree().reload_current_scene()
|
||||||
|
|
||||||
|
|
||||||
|
func on_main_menu_button_pressed() -> void:
|
||||||
|
if not gm or not main_menu_scene:
|
||||||
|
return
|
||||||
|
|
||||||
|
gm.reset_player_state()
|
||||||
|
get_tree().change_scene_to(main_menu_scene)
|
||||||
|
|
||||||
|
|
||||||
|
func on_player_death() -> void:
|
||||||
|
if not gm or not gm.get_lives() == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
game_over_screen.show()
|
1
scripts/ui/game_over_screen.gd.uid
Normal file
1
scripts/ui/game_over_screen.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bkd7o2u4psu4p
|
@@ -6,14 +6,13 @@ extends Node
|
|||||||
@export var quit_button: Button
|
@export var quit_button: Button
|
||||||
@export var settings_button: Button
|
@export var settings_button: Button
|
||||||
@export var exit_to_menu_button: Button
|
@export var exit_to_menu_button: Button
|
||||||
@export var settings_menu: PackedScene
|
@export var settings_menu: Control
|
||||||
@export var exit_to_menu_scene: PackedScene
|
@export var exit_to_menu_scene: PackedScene
|
||||||
|
|
||||||
@onready var gm: GM = $"/root/GameManager"
|
@onready var gm: GM = $"/root/GameManager"
|
||||||
|
|
||||||
var is_paused: bool = false
|
var is_paused: bool = false
|
||||||
var is_console_open: bool = false
|
var is_console_open: bool = false
|
||||||
var settings_menu_instance: Control
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -60,9 +59,8 @@ func _input(event: InputEvent) -> void:
|
|||||||
|
|
||||||
func _on_resume_button_pressed() -> void:
|
func _on_resume_button_pressed() -> void:
|
||||||
pause_menu_control.hide()
|
pause_menu_control.hide()
|
||||||
if settings_menu_instance:
|
if settings_menu:
|
||||||
settings_menu_instance.queue_free()
|
settings_menu.hide()
|
||||||
settings_menu_instance = null
|
|
||||||
gm.resume_game()
|
gm.resume_game()
|
||||||
is_paused = false
|
is_paused = false
|
||||||
|
|
||||||
@@ -76,10 +74,7 @@ func _on_settings_button_pressed() -> void:
|
|||||||
printerr("PauseMenu: Settings menu scene not set.")
|
printerr("PauseMenu: Settings menu scene not set.")
|
||||||
return
|
return
|
||||||
|
|
||||||
var settings_instance: Control = settings_menu.instantiate()
|
settings_menu.show()
|
||||||
add_child(settings_instance)
|
|
||||||
settings_instance.show()
|
|
||||||
settings_menu_instance = settings_instance
|
|
||||||
gm.pause_game()
|
gm.pause_game()
|
||||||
is_paused = true
|
is_paused = true
|
||||||
|
|
95
scripts/ui/settings_menu.gd
Normal file
95
scripts/ui/settings_menu.gd
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
class_name SettingsMenu
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var input_settings: Control
|
||||||
|
@export var audio_settings: Control
|
||||||
|
@export var display_settings: Control
|
||||||
|
@export var gameplay_settings: Control
|
||||||
|
@export var settings_menu_control: Control
|
||||||
|
@export var input_settings_button: Button
|
||||||
|
@export var audio_settings_button: Button
|
||||||
|
@export var display_settings_button: Button
|
||||||
|
@export var gameplay_settings_button: Button
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if not settings_menu_control or not input_settings_button or not audio_settings_button or not display_settings_button or not gameplay_settings_button:
|
||||||
|
printerr("No settings menu control or buttons found.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if input_settings:
|
||||||
|
input_settings_button.pressed.connect(_on_input_settings_button_pressed)
|
||||||
|
input_settings.hide()
|
||||||
|
|
||||||
|
if audio_settings:
|
||||||
|
audio_settings_button.pressed.connect(_on_audio_settings_button_pressed)
|
||||||
|
audio_settings.hide()
|
||||||
|
|
||||||
|
if display_settings:
|
||||||
|
|
||||||
|
display_settings_button.pressed.connect(_on_display_settings_button_pressed)
|
||||||
|
display_settings.hide()
|
||||||
|
|
||||||
|
if gameplay_settings:
|
||||||
|
gameplay_settings_button.pressed.connect(_on_gameplay_settings_button_pressed)
|
||||||
|
gameplay_settings.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("ui_cancel"):
|
||||||
|
if settings_menu_control.is_visible():
|
||||||
|
settings_menu_control.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_input_settings_button_pressed() -> void:
|
||||||
|
if not input_settings:
|
||||||
|
return
|
||||||
|
|
||||||
|
if input_settings.is_visible():
|
||||||
|
input_settings.hide()
|
||||||
|
else:
|
||||||
|
input_settings.show()
|
||||||
|
audio_settings.hide()
|
||||||
|
display_settings.hide()
|
||||||
|
gameplay_settings.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_audio_settings_button_pressed() -> void:
|
||||||
|
if not audio_settings:
|
||||||
|
return
|
||||||
|
|
||||||
|
if audio_settings.is_visible():
|
||||||
|
audio_settings.hide()
|
||||||
|
else:
|
||||||
|
audio_settings.show()
|
||||||
|
input_settings.hide()
|
||||||
|
display_settings.hide()
|
||||||
|
gameplay_settings.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_display_settings_button_pressed() -> void:
|
||||||
|
if not display_settings:
|
||||||
|
return
|
||||||
|
|
||||||
|
if display_settings.is_visible():
|
||||||
|
display_settings.hide()
|
||||||
|
else:
|
||||||
|
display_settings.show()
|
||||||
|
input_settings.hide()
|
||||||
|
audio_settings.hide()
|
||||||
|
gameplay_settings.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_gameplay_settings_button_pressed() -> void:
|
||||||
|
if not gameplay_settings:
|
||||||
|
return
|
||||||
|
|
||||||
|
if gameplay_settings.is_visible():
|
||||||
|
gameplay_settings.hide()
|
||||||
|
else:
|
||||||
|
gameplay_settings.show()
|
||||||
|
input_settings.hide()
|
||||||
|
audio_settings.hide()
|
||||||
|
display_settings.hide()
|
||||||
|
|
||||||
|
|
BIN
sprites/backgrounds/plains/1.png
Normal file
BIN
sprites/backgrounds/plains/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
34
sprites/backgrounds/plains/1.png.import
Normal file
34
sprites/backgrounds/plains/1.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d2f4ooucvrjcc"
|
||||||
|
path="res://.godot/imported/1.png-59f3f5550d7f03f48e8229a334026798.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/backgrounds/plains/1.png"
|
||||||
|
dest_files=["res://.godot/imported/1.png-59f3f5550d7f03f48e8229a334026798.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
sprites/backgrounds/plains/2.png
Normal file
BIN
sprites/backgrounds/plains/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
34
sprites/backgrounds/plains/2.png.import
Normal file
34
sprites/backgrounds/plains/2.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cdgk3fi8owc6o"
|
||||||
|
path="res://.godot/imported/2.png-45ed2f33d94b943d79ec5e1fda64f231.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/backgrounds/plains/2.png"
|
||||||
|
dest_files=["res://.godot/imported/2.png-45ed2f33d94b943d79ec5e1fda64f231.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
sprites/backgrounds/plains/3.png
Normal file
BIN
sprites/backgrounds/plains/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
34
sprites/backgrounds/plains/3.png.import
Normal file
34
sprites/backgrounds/plains/3.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://p0bt2k2lihlx"
|
||||||
|
path="res://.godot/imported/3.png-c46b1707fe24503472286118eb90fef3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/backgrounds/plains/3.png"
|
||||||
|
dest_files=["res://.godot/imported/3.png-c46b1707fe24503472286118eb90fef3.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
sprites/backgrounds/plains/4.png
Normal file
BIN
sprites/backgrounds/plains/4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
34
sprites/backgrounds/plains/4.png.import
Normal file
34
sprites/backgrounds/plains/4.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bcahm7wqdbn6n"
|
||||||
|
path="res://.godot/imported/4.png-dca9b7ac133b8002b185068071b3f8a9.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/backgrounds/plains/4.png"
|
||||||
|
dest_files=["res://.godot/imported/4.png-dca9b7ac133b8002b185068071b3f8a9.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Reference in New Issue
Block a user