Add audio bus configuration for various sound effects and update main scene reference

This commit is contained in:
2025-05-25 12:57:16 +02:00
parent dd921e3396
commit 5b793736f4
21 changed files with 274 additions and 2 deletions

15
default_bus_layout.tres Normal file
View File

@@ -0,0 +1,15 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://b2d2n7cffo3bi"]
[resource]
bus/1/name = &"music"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 0.0
bus/1/send = &"Master"
bus/2/name = &"sfx"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = 0.0
bus/2/send = &"Master"

View File

@@ -6,4 +6,5 @@
[node name="Background Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource("1_fuc3i")
bus = &"music"
parameters/looping = true

View File

@@ -40,3 +40,4 @@ area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_dbffd")
volume_db = -5.0
bus = &"sfx"

View File

@@ -38,3 +38,4 @@ area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_fxf8v")
bus = &"sfx"

View File

@@ -220,12 +220,15 @@ script = ExtResource("17_hglfj")
[node name="sfx_jump" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("18_pysae")
bus = &"sfx"
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("19_7anly")
bus = &"sfx"
[node name="sfx_heal" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("20_bptj5")
bus = &"sfx"
[node name="ChargingBarLayer" parent="." instance=ExtResource("28_3f5nm")]
offset_left = -17.0

View File

@@ -54,3 +54,4 @@ sfx = NodePath("../sfx_pickup")
[node name="sfx_pickup" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("7_j8eyh")
bus = &"sfx"

View File

@@ -39,3 +39,4 @@ area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_4jc2c")
volume_db = -10.0
bus = &"sfx"

View File

@@ -166,9 +166,11 @@ ice_fx = NodePath("../Ice FX")
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("13_u4k3d")
bus = &"sfx"
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("14_tdjks")
bus = &"sfx"
[node name="FireFX" parent="." instance=ExtResource("15_mc6rj")]
position = Vector2(0, 9)

View File

@@ -113,9 +113,11 @@ metadata/_custom_type_script = "uid://btfsq0bvtrx3t"
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3_fd2du")
bus = &"sfx"
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("4_rhq76")
bus = &"sfx"
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")]
script = ExtResource("5_cmp1h")

View File

@@ -30,3 +30,4 @@ sfx = NodePath("../sfx")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3_gipby")
bus = &"sfx"

View File

@@ -39,3 +39,4 @@ area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_xt2rk")
volume_db = -5.0
bus = &"sfx"

57
objects/ui/credits.tscn Normal file
View File

@@ -0,0 +1,57 @@
[gd_scene load_steps=3 format=3 uid="uid://bwgmrcyj4mvu"]
[ext_resource type="Script" uid="uid://dtjgndehihl6d" path="res://scripts/ui/credits.gd" id="1_3aqj3"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g4ivv"]
bg_color = Color(0, 0, 0, 1)
[node name="Credits" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 6
size_flags_vertical = 6
script = ExtResource("1_3aqj3")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_g4ivv")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 32
[node name="Pause" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "CREDITS"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
text = "Game was created by Gabriel Kaszewski.
Main character was drawn by my girlfriend <3
I would like to thank all of my friends that encouraged my during development of this game.
For now this is it, enjoy the game!
"
fit_content = true

84
objects/ui/main_menu.tscn Normal file
View File

@@ -0,0 +1,84 @@
[gd_scene load_steps=3 format=3 uid="uid://8b6ol5sssbgo"]
[ext_resource type="Script" uid="uid://hyfvthdbgjbc" path="res://scripts/ui/main_menu.gd" id="1_epxpl"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qv2q0"]
bg_color = Color(0, 0, 0, 1)
[node name="MainMenu" type="Control" node_paths=PackedStringArray("main_menu_control", "new_game_button", "continue_button", "settings_button", "credits_button", "exit_button", "version_label")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_epxpl")
main_menu_control = NodePath(".")
new_game_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/NewGameButton")
continue_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/ContinueButton")
settings_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/SettingsButton")
credits_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/CreditsButton")
exit_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/QuitButton")
version_label = NodePath("PanelContainer/MarginContainer/VBoxContainer/version")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_qv2q0")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 16
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "MR. BRICK ADVENTURES"
horizontal_alignment = 1
uppercase = true
[node name="Spacer" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 32)
layout_mode = 2
size_flags_vertical = 3
[node name="ContinueButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "CONTINUE"
flat = true
[node name="NewGameButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "NEW GAME"
flat = true
[node name="SettingsButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "SETTINGS"
flat = true
[node name="CreditsButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "CREDITS"
flat = true
[node name="QuitButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "QUIT GAME"
flat = true
[node name="version" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 8
text = "v. in-dev"

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://i6mnjbjcoqe5"]
[gd_scene load_steps=4 format=3 uid="uid://i6mnjbjcoqe5"]
[ext_resource type="Script" uid="uid://cugifchx6jhuk" path="res://scripts/ui/pause_menu.gd" id="1_aktha"]
[ext_resource type="PackedScene" uid="uid://cl00e2ocomk3m" path="res://scenes/main_menu.tscn" id="2_h4pd5"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g4ivv"]
bg_color = Color(0, 0, 0, 1)
@@ -20,6 +21,7 @@ resume_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Resume Bu
quit_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Quit game Button")
settings_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Settings Button")
exit_to_menu_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Exit to menu Button")
exit_to_menu_scene = ExtResource("2_h4pd5")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1

View File

@@ -16,9 +16,10 @@ config/name_localized={
"pl": "Przygody Pana Cegły"
}
config/version="in-dev"
run/main_scene="uid://bol7g83v2accs"
run/main_scene="uid://cl00e2ocomk3m"
config/features=PackedStringArray("4.4", "GL Compatibility")
run/max_fps=180
boot_splash/bg_color=Color(0, 0, 0, 1)
boot_splash/show_image=false
boot_splash/fullsize=false
boot_splash/use_filter=false

17
scenes/main_menu.tscn Normal file
View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=4 format=3 uid="uid://cl00e2ocomk3m"]
[ext_resource type="PackedScene" uid="uid://8b6ol5sssbgo" path="res://objects/ui/main_menu.tscn" id="1_ekxnf"]
[ext_resource type="PackedScene" uid="uid://y0ae6e7t70fj" path="res://objects/ui/settings_menu.tscn" id="2_bqqt6"]
[ext_resource type="PackedScene" uid="uid://bwgmrcyj4mvu" path="res://objects/ui/credits.tscn" id="3_bqqt6"]
[node name="Main menu" type="CanvasLayer"]
[node name="MainMenu" parent="." node_paths=PackedStringArray("settings_control", "credits_control") instance=ExtResource("1_ekxnf")]
settings_control = NodePath("../Settings menu")
credits_control = NodePath("../Credits")
[node name="Settings menu" parent="." instance=ExtResource("2_bqqt6")]
visible = false
[node name="Credits" parent="." instance=ExtResource("3_bqqt6")]
visible = false

View File

@@ -142,3 +142,20 @@ func pause_game() -> void:
func resume_game() -> void:
Engine.time_scale = 1
func start_new_game() -> void:
reset_player_state()
player_state["current_level"] = 0
player_state["unlocked_levels"] = [0] # Start with the first level unlocked
get_tree().change_scene_to_packed(level_scenes[0])
func continue_game() -> void:
# todo: load player state from save file
if player_state["current_level"] < level_scenes.size():
get_tree().change_scene_to_packed(level_scenes[player_state["current_level"]])
else:
printerr("No levels unlocked to continue.")

6
scripts/ui/credits.gd Normal file
View File

@@ -0,0 +1,6 @@
extends Control
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
if UiManager.is_screen_on_top(self):
UiManager.pop_screen()

View File

@@ -0,0 +1 @@
uid://dtjgndehihl6d

57
scripts/ui/main_menu.gd Normal file
View File

@@ -0,0 +1,57 @@
extends Node
@export var main_menu_control: Control
@export var new_game_button: Button
@export var continue_button: Button
@export var settings_button: Button
@export var credits_button: Button
@export var exit_button: Button
@export var version_label: Label
@export var settings_control: Control
@export var credits_control: Control
@onready var gm: GM = $"/root/GameManager"
func _ready() -> void:
if new_game_button:
new_game_button.pressed.connect(_on_new_game_button_pressed)
if continue_button:
continue_button.pressed.connect(_on_continue_button_pressed)
if settings_button:
settings_button.pressed.connect(_on_settings_button_pressed)
if credits_button:
credits_button.pressed.connect(_on_credits_button_pressed)
if exit_button:
exit_button.pressed.connect(quit_game)
if version_label:
version_label.text = "v. " + ProjectSettings.get_setting("application/config/version")
func _on_new_game_button_pressed() -> void:
if gm:
gm.start_new_game()
else:
printerr("GameManager not found. Cannot start new game.")
func _on_continue_button_pressed() -> void:
if gm:
gm.continue_game()
else:
printerr("GameManager not found. Cannot continue game.")
func quit_game() -> void:
if gm:
gm.quit_game()
func _on_settings_button_pressed() -> void:
if settings_control:
UiManager.push_screen(settings_control)
func _on_credits_button_pressed() -> void:
if credits_control:
UiManager.push_screen(credits_control)

View File

@@ -0,0 +1 @@
uid://hyfvthdbgjbc