diff --git a/default_bus_layout.tres b/default_bus_layout.tres new file mode 100644 index 0000000..78b719a --- /dev/null +++ b/default_bus_layout.tres @@ -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" diff --git a/objects/audio_controller.tscn b/objects/audio_controller.tscn index 956df7f..dd83797 100644 --- a/objects/audio_controller.tscn +++ b/objects/audio_controller.tscn @@ -6,4 +6,5 @@ [node name="Background Music" type="AudioStreamPlayer" parent="."] stream = ExtResource("1_fuc3i") +bus = &"music" parameters/looping = true diff --git a/objects/entities/big_coin.tscn b/objects/entities/big_coin.tscn index 47b4a35..10c1b29 100644 --- a/objects/entities/big_coin.tscn +++ b/objects/entities/big_coin.tscn @@ -40,3 +40,4 @@ area2d = NodePath("..") [node name="sfx" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("5_dbffd") volume_db = -5.0 +bus = &"sfx" diff --git a/objects/entities/big_treasure.tscn b/objects/entities/big_treasure.tscn index e5393b9..baf907e 100644 --- a/objects/entities/big_treasure.tscn +++ b/objects/entities/big_treasure.tscn @@ -38,3 +38,4 @@ area2d = NodePath("..") [node name="sfx" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("5_fxf8v") +bus = &"sfx" diff --git a/objects/entities/brick_player.tscn b/objects/entities/brick_player.tscn index 812f6a0..2073842 100644 --- a/objects/entities/brick_player.tscn +++ b/objects/entities/brick_player.tscn @@ -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 diff --git a/objects/entities/child.tscn b/objects/entities/child.tscn index 9777749..f1c81ef 100644 --- a/objects/entities/child.tscn +++ b/objects/entities/child.tscn @@ -54,3 +54,4 @@ sfx = NodePath("../sfx_pickup") [node name="sfx_pickup" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("7_j8eyh") +bus = &"sfx" diff --git a/objects/entities/coin.tscn b/objects/entities/coin.tscn index b406666..1dc80b1 100644 --- a/objects/entities/coin.tscn +++ b/objects/entities/coin.tscn @@ -39,3 +39,4 @@ area2d = NodePath("..") [node name="sfx" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("5_4jc2c") volume_db = -10.0 +bus = &"sfx" diff --git a/objects/entities/enemy.tscn b/objects/entities/enemy.tscn index b2b5f4a..d679692 100644 --- a/objects/entities/enemy.tscn +++ b/objects/entities/enemy.tscn @@ -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) diff --git a/objects/entities/flying_enemy.tscn b/objects/entities/flying_enemy.tscn index bbfe95c..1388317 100644 --- a/objects/entities/flying_enemy.tscn +++ b/objects/entities/flying_enemy.tscn @@ -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") diff --git a/objects/entities/lever.tscn b/objects/entities/lever.tscn index 01b5ee9..b7ac3aa 100644 --- a/objects/entities/lever.tscn +++ b/objects/entities/lever.tscn @@ -30,3 +30,4 @@ sfx = NodePath("../sfx") [node name="sfx" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("3_gipby") +bus = &"sfx" diff --git a/objects/entities/treasure.tscn b/objects/entities/treasure.tscn index a32a793..db3528d 100644 --- a/objects/entities/treasure.tscn +++ b/objects/entities/treasure.tscn @@ -39,3 +39,4 @@ area2d = NodePath("..") [node name="sfx" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("5_xt2rk") volume_db = -5.0 +bus = &"sfx" diff --git a/objects/ui/credits.tscn b/objects/ui/credits.tscn new file mode 100644 index 0000000..ece74ea --- /dev/null +++ b/objects/ui/credits.tscn @@ -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 diff --git a/objects/ui/main_menu.tscn b/objects/ui/main_menu.tscn new file mode 100644 index 0000000..81c3f10 --- /dev/null +++ b/objects/ui/main_menu.tscn @@ -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" diff --git a/objects/ui/pause_menu.tscn b/objects/ui/pause_menu.tscn index da7a9bf..0343439 100644 --- a/objects/ui/pause_menu.tscn +++ b/objects/ui/pause_menu.tscn @@ -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 diff --git a/project.godot b/project.godot index 3e5f450..6cd1658 100644 --- a/project.godot +++ b/project.godot @@ -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 diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn new file mode 100644 index 0000000..4e03451 --- /dev/null +++ b/scenes/main_menu.tscn @@ -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 diff --git a/scripts/game_manager.gd b/scripts/game_manager.gd index 84e52c6..7c94a82 100644 --- a/scripts/game_manager.gd +++ b/scripts/game_manager.gd @@ -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.") \ No newline at end of file diff --git a/scripts/ui/credits.gd b/scripts/ui/credits.gd new file mode 100644 index 0000000..9916e90 --- /dev/null +++ b/scripts/ui/credits.gd @@ -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() \ No newline at end of file diff --git a/scripts/ui/credits.gd.uid b/scripts/ui/credits.gd.uid new file mode 100644 index 0000000..f799384 --- /dev/null +++ b/scripts/ui/credits.gd.uid @@ -0,0 +1 @@ +uid://dtjgndehihl6d diff --git a/scripts/ui/main_menu.gd b/scripts/ui/main_menu.gd new file mode 100644 index 0000000..b6b479c --- /dev/null +++ b/scripts/ui/main_menu.gd @@ -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) \ No newline at end of file diff --git a/scripts/ui/main_menu.gd.uid b/scripts/ui/main_menu.gd.uid new file mode 100644 index 0000000..e0ff008 --- /dev/null +++ b/scripts/ui/main_menu.gd.uid @@ -0,0 +1 @@ +uid://hyfvthdbgjbc