Refactor console and scene structure; update resource paths and add configuration handling

This commit is contained in:
2025-05-03 19:49:23 +02:00
parent aa2bd7b3b0
commit f75d05dde1
59 changed files with 714 additions and 136 deletions

View File

@@ -3,7 +3,6 @@ extends Node
var enabled := true
var enable_on_release_build := false: set = set_enable_on_release_build
var pause_enabled := false
signal console_opened
signal console_closed
signal console_unknown_command
@@ -15,6 +14,8 @@ class ConsoleCommand:
var required: int
var description: String
var hidden: bool
func _init(in_function: Callable, in_arguments: PackedStringArray, in_required: int = 0, in_description: String = ""):
function = in_function
arguments = in_arguments
@@ -23,18 +24,17 @@ class ConsoleCommand:
var control := Control.new()
# If you want to customize the way the console looks, you can direcly modify
# the properties of the rich text and line edit here:
var rich_label := RichTextLabel.new()
var line_edit := LineEdit.new()
var console_commands := {}
var command_parameters := {}
var console_history := []
var console_history_index := 0
var was_paused_already := false
## Usage: Console.add_command("command_name", <function to call>, <number of arguments or array of argument names>, <required number of arguments>, "Help description")
func add_command(command_name: String, function: Callable, arguments = [], required: int = 0, description: String = "") -> void:
if (arguments is int):
@@ -87,7 +87,7 @@ func _enter_tree() -> void:
style.bg_color = Color("000000d7")
rich_label.selection_enabled = true
rich_label.context_menu_enabled = true
rich_label.bbcode_enabled = true
rich_label.bbcode_enabled = false
rich_label.scroll_following = true
rich_label.anchor_right = 1.0
rich_label.anchor_bottom = 0.5
@@ -133,6 +133,7 @@ func _ready() -> void:
add_command("unpause", unpause, 0, 0, "Unpauses node processing.")
add_command("exec", exec, 1, 1, "Execute a script.")
func _input(event: InputEvent) -> void:
if (event is InputEventKey):
if (event.get_physical_keycode_with_modifiers() == KEY_QUOTELEFT): # ~ key.
@@ -190,6 +191,7 @@ var suggestions := []
var current_suggest := 0
var suggesting := false
func autocomplete() -> void:
if (suggesting):
for i in range(suggestions.size()):
@@ -289,11 +291,13 @@ func print_error(text : Variant, print_godot := false) -> void:
text = str(text)
print_line("[color=light_coral] ERROR:[/color] %s" % text, print_godot)
func print_info(text: Variant, print_godot := false) -> void:
if not text is String:
text = str(text)
print_line("[color=light_blue] INFO:[/color] %s" % text, print_godot)
func print_warning(text: Variant, print_godot := false) -> void:
if not text is String:
text = str(text)
@@ -430,6 +434,27 @@ func help() -> void:
[color=light_blue]Tab[/color] key to autocomplete, [color=light_blue]Tab[/color] again to cycle between matching suggestions\n\n")
func calculate(command: String) -> void:
var expression := Expression.new()
var error = expression.parse(command)
@@ -488,9 +513,11 @@ func set_enable_on_release_build(enable : bool):
func pause() -> void:
get_tree().paused = true
func unpause() -> void:
get_tree().paused = false
func exec(filename: String) -> void:
var path := "user://%s.txt" % [filename]
var script := FileAccess.open(path, FileAccess.READ)

View File

@@ -0,0 +1,13 @@
extends Node
var settings_config := ConfigFile.new()
const SETTINGS_PATH := "user://settings.ini"
func _ready() -> void:
if !FileAccess.file_exists(SETTINGS_PATH):
settings_config.set_value("keybinding", "left", "A")
settings_config.save(SETTINGS_PATH)
else:
settings_config.load(SETTINGS_PATH)

View File

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

View File

@@ -77,7 +77,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="builds/index.html"
export_path="builds/web/index.html"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://rnpsa2u74nio"]
[ext_resource type="Script" uid="uid://deguukal87gcb" path="res://scripts/achievements.gd" id="1_1itsx"]
[node name="Achievements" type="Node"]
script = ExtResource("1_1itsx")

View File

@@ -8,7 +8,7 @@
[ext_resource type="Script" uid="uid://qeu80jy4vmuf" path="res://scripts/components/score.gd" id="6_fowa2"]
[ext_resource type="Script" uid="uid://btfsq0bvtrx3t" path="res://scripts/components/health.gd" id="7_tqjk8"]
[ext_resource type="Script" uid="uid://dkpu3121y88oo" path="res://scripts/components/player_death.gd" id="8_1v23d"]
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/explosion_fx.tscn" id="9_hwg11"]
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="9_hwg11"]
[ext_resource type="Script" uid="uid://nogmyshjrv57" path="res://scripts/components/knockback.gd" id="9_rjyu4"]
[ext_resource type="Script" uid="uid://ulhswh4jjlc6" path="res://scripts/components/stomp_damage_component.gd" id="12_payr4"]
[ext_resource type="Script" uid="uid://dqmbvuutd5c3c" path="res://scripts/components/flashing_component.gd" id="13_hrtyn"]

View File

@@ -14,8 +14,8 @@
[ext_resource type="Script" uid="uid://dhj4qtwcqmqkj" path="res://scripts/components/ice_effect_component.gd" id="11_pq0k7"]
[ext_resource type="AudioStream" uid="uid://b3tsqhr06pbrs" path="res://sfx/enemy_hurt.wav" id="13_u4k3d"]
[ext_resource type="AudioStream" uid="uid://dyev46uqusimi" path="res://sfx/shoot.wav" id="14_tdjks"]
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fire_fx.tscn" id="15_mc6rj"]
[ext_resource type="PackedScene" uid="uid://ck6nml06tm6ue" path="res://objects/ice_fx.tscn" id="16_68hnm"]
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fxs/fire_fx.tscn" id="15_mc6rj"]
[ext_resource type="PackedScene" uid="uid://ck6nml06tm6ue" path="res://objects/fxs/ice_fx.tscn" id="16_68hnm"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pwwji"]
size = Vector2(25, 31)

View File

@@ -4,7 +4,7 @@
[ext_resource type="Script" uid="uid://bh2vrkdbrtpin" path="res://scripts/components/bullet.gd" id="2_1i2y5"]
[ext_resource type="Script" uid="uid://dkmxhjtmu5xlb" path="res://scripts/components/damage_component.gd" id="3_y0uai"]
[ext_resource type="Script" uid="uid://beg4dk7d5pvhp" path="res://scripts/components/explosive_component.gd" id="4_8lw0n"]
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/explosion_fx.tscn" id="5_6oopj"]
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="5_6oopj"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"]
size = Vector2(16, 10)

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=7 format=4 uid="uid://dnufqkeiyi5ya"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_51i2x"]
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/coin.tscn" id="2_2l4v1"]
[ext_resource type="PackedScene" uid="uid://ct8fim6mduyl3" path="res://objects/collapsing_bridge.tscn" id="3_ukc1k"]
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/entities/coin.tscn" id="2_2l4v1"]
[ext_resource type="PackedScene" uid="uid://ct8fim6mduyl3" path="res://objects/entities/collapsing_bridge.tscn" id="3_ukc1k"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_8idcv"]
texture = ExtResource("1_51i2x")

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://coayig4dxelo2"]
[ext_resource type="Script" uid="uid://cm06xg1l3xtw5" path="res://scripts/components/brick_throw.gd" id="1_hniwk"]
[ext_resource type="PackedScene" uid="uid://bymro4t7angv5" path="res://objects/brick.tscn" id="2_4txoq"]
[ext_resource type="PackedScene" uid="uid://bymro4t7angv5" path="res://objects/entities/brick.tscn" id="2_4txoq"]
[node name="BrickThrowComponent" type="Node"]
script = ExtResource("1_hniwk")

View File

@@ -0,0 +1,50 @@
[gd_scene load_steps=3 format=3 uid="uid://bxpr4m7lq7clh"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h8s4o"]
bg_color = Color(1, 1, 1, 0.392157)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_v2gus"]
bg_color = Color(0, 0, 0, 0.501961)
[node name="Input button" type="Button"]
custom_minimum_size = Vector2(0, 16)
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
theme_override_styles/hover = SubResource("StyleBoxFlat_h8s4o")
theme_override_styles/pressed = SubResource("StyleBoxFlat_h8s4o")
theme_override_styles/normal = SubResource("StyleBoxFlat_v2gus")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2
[node name="LabelAction" type="Label" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
mouse_filter = 1
text = "left"
vertical_alignment = 1
uppercase = true
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 1
[node name="LabelInput" type="Label" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
mouse_filter = 1
text = "A"
vertical_alignment = 1
uppercase = true

View File

@@ -0,0 +1,76 @@
[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="Script" uid="uid://dppwl7xie2mh" path="res://scripts/input_settings.gd" id="1_v2gus"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_se25o"]
bg_color = Color(0, 0, 0, 1)
[node name="Input Settings" type="Control" node_paths=PackedStringArray("action_list", "reset_to_default_button")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_v2gus")
action_list = NodePath("PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions")
reset_to_default_button = NodePath("PanelContainer/MarginContainer/VBoxContainer/Reset to default Button")
[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_se25o")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 16
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "input"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Actions" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 8
[node name="Input button" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions" instance=ExtResource("1_h8s4o")]
layout_mode = 2
[node name="Input button2" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions" instance=ExtResource("1_h8s4o")]
layout_mode = 2
[node name="Input button3" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions" instance=ExtResource("1_h8s4o")]
layout_mode = 2
[node name="Input button4" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions" instance=ExtResource("1_h8s4o")]
layout_mode = 2
[node name="Input button5" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions" instance=ExtResource("1_h8s4o")]
layout_mode = 2
[node name="Input button6" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions" instance=ExtResource("1_h8s4o")]
layout_mode = 2
[node name="Reset to default Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "RESET TO DEFAULT"
flat = true

View File

@@ -8,7 +8,7 @@
[ext_resource type="Resource" uid="uid://2glvryih82t1" path="res://resources/skills/fire_brick.tres" id="5_fqx8e"]
[ext_resource type="Resource" uid="uid://cx5fsbexblp60" path="res://resources/skills/ice_brick.tres" id="6_6665y"]
[ext_resource type="Resource" uid="uid://d3bjre2etov1n" path="res://resources/skills/magnetic.tres" id="7_ukny6"]
[ext_resource type="PackedScene" uid="uid://dtl03rod7l2t0" path="res://objects/marketplace_button.tscn" id="9_ode10"]
[ext_resource type="PackedScene" uid="uid://dtl03rod7l2t0" path="res://objects/ui/marketplace_button.tscn" id="9_ode10"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ode10"]
bg_color = Color(0, 0, 0, 1)

View File

@@ -0,0 +1,72 @@
[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"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wgbcl"]
bg_color = Color(0, 0, 0, 1)
[node name="Settings menu" type="Control" node_paths=PackedStringArray("settings_menu_control")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_lt6q2")
settings_menu_control = NodePath(".")
[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_wgbcl")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 16
[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
theme_override_font_sizes/font_size = 16
text = "settings"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
[node name="Spacer" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Input Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "INPUT"
flat = true
[node name="Display Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "DISPLAY"
flat = true
[node name="Audio Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "AUDIO"
flat = true
[node name="Gameplay Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "GAMEPLAY"
flat = true
[node name="Spacer2" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3

View File

@@ -22,7 +22,7 @@ run/max_fps=144
boot_splash/show_image=false
boot_splash/fullsize=false
boot_splash/use_filter=false
config/icon="res://icon.svg"
config/icon="uid://jix7wdn0isr3"
[autoload]
@@ -32,6 +32,8 @@ AudioController="*res://objects/audio_controller.tscn"
SteamIntegrationNode="*res://objects/steam_integration.tscn"
SteamControllerInput="*res://autoloads/steam_controller_input.gd"
Console="*res://addons/console/console.gd"
AchievementsManager="*res://objects/achievements.tscn"
ConfigFileHandler="*res://autoloads/config_file_handler.gd"
[debug]
@@ -39,10 +41,11 @@ file_logging/enable_file_logging=true
[display]
window/size/viewport_width=640
window/size/viewport_height=360
window/size/window_width_override=1280
window/size/window_height_override=720
window/size/viewport_width=480
window/size/viewport_height=270
window/size/initial_position=Vector2i(400, 100)
window/size/window_width_override=1440
window/size/window_height_override=810
window/stretch/mode="viewport"
window/stretch/aspect="keep_height"
window/stretch/scale_mode="integer"
@@ -68,6 +71,7 @@ player=""
[gui]
theme/default_theme_scale=0.5
theme/custom_font="res://fonts/PressStart2P-Regular.ttf"
theme/default_font_antialiasing=0

View File

@@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="SkillData" load_steps=4 format=3 uid="uid://cdp8sex36vdq2"]
[ext_resource type="PackedScene" uid="uid://5surx230gfw3" path="res://objects/exploding_brick.tscn" id="1_6pfoa"]
[ext_resource type="PackedScene" uid="uid://5surx230gfw3" path="res://objects/entities/exploding_brick.tscn" id="1_6pfoa"]
[ext_resource type="PackedScene" uid="uid://coayig4dxelo2" path="res://objects/player_skills/brick_throw_skill.tscn" id="2_e0o8w"]
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="3_cgsq1"]

View File

@@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="SkillData" load_steps=4 format=3 uid="uid://2glvryih82t1"]
[ext_resource type="PackedScene" uid="uid://daau4j5hbklk0" path="res://objects/fire_brick.tscn" id="1_2g43l"]
[ext_resource type="PackedScene" uid="uid://daau4j5hbklk0" path="res://objects/entities/fire_brick.tscn" id="1_2g43l"]
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="1_2j5ko"]
[ext_resource type="PackedScene" uid="uid://coayig4dxelo2" path="res://objects/player_skills/brick_throw_skill.tscn" id="1_g53fp"]

View File

@@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="SkillData" load_steps=4 format=3 uid="uid://cx5fsbexblp60"]
[ext_resource type="PackedScene" uid="uid://bcmx07k12gcsc" path="res://objects/ice_brick.tscn" id="1_ci3d1"]
[ext_resource type="PackedScene" uid="uid://bcmx07k12gcsc" path="res://objects/entities/ice_brick.tscn" id="1_ci3d1"]
[ext_resource type="PackedScene" uid="uid://coayig4dxelo2" path="res://objects/player_skills/brick_throw_skill.tscn" id="1_rflri"]
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="2_pspkt"]

View File

@@ -1,32 +1,35 @@
[gd_scene load_steps=39 format=4 uid="uid://h60obxmju6mo"]
[gd_scene load_steps=42 format=4 uid="uid://h60obxmju6mo"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_5lb42"]
[ext_resource type="TileSet" uid="uid://cl4bn8lofqvky" path="res://tileset/village/tileset_village.tres" id="1_d680t"]
[ext_resource type="PackedScene" uid="uid://byxf45ukq82pe" path="res://objects/hud.tscn" id="1_gbpkv"]
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/explosion_fx.tscn" id="1_iqo0b"]
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fire_fx.tscn" id="2_h1oxb"]
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/coin.tscn" id="3_ygehw"]
[ext_resource type="PackedScene" uid="uid://bqi5s710xb1ju" path="res://objects/brick_player.tscn" id="4_hetw8"]
[ext_resource type="PackedScene" uid="uid://bargnp4twtmxg" path="res://objects/big_coin.tscn" id="5_bpga1"]
[ext_resource type="PackedScene" uid="uid://ct8fim6mduyl3" path="res://objects/collapsing_bridge.tscn" id="6_84ckv"]
[ext_resource type="PackedScene" uid="uid://d08dfqmirnd66" path="res://objects/big_treasure.tscn" id="6_a3vrq"]
[ext_resource type="PackedScene" uid="uid://073ts5cxtwbl" path="res://objects/treasure.tscn" id="7_4mhb5"]
[ext_resource type="PackedScene" uid="uid://byxf45ukq82pe" path="res://objects/ui/hud.tscn" id="1_gbpkv"]
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="1_iqo0b"]
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fxs/fire_fx.tscn" id="2_h1oxb"]
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/entities/coin.tscn" id="3_ygehw"]
[ext_resource type="PackedScene" uid="uid://bqi5s710xb1ju" path="res://objects/entities/brick_player.tscn" id="4_hetw8"]
[ext_resource type="PackedScene" uid="uid://bargnp4twtmxg" path="res://objects/entities/big_coin.tscn" id="5_bpga1"]
[ext_resource type="PackedScene" uid="uid://ct8fim6mduyl3" path="res://objects/entities/collapsing_bridge.tscn" id="6_84ckv"]
[ext_resource type="PackedScene" uid="uid://d08dfqmirnd66" path="res://objects/entities/big_treasure.tscn" id="6_a3vrq"]
[ext_resource type="PackedScene" uid="uid://073ts5cxtwbl" path="res://objects/entities/treasure.tscn" id="7_4mhb5"]
[ext_resource type="Script" uid="uid://cie33tct7ehf0" path="res://addons/phantom_camera/scripts/phantom_camera_host/phantom_camera_host.gd" id="7_jgh7o"]
[ext_resource type="PackedScene" uid="uid://bwdlmualj6xbw" path="res://objects/enemy.tscn" id="7_qgddg"]
[ext_resource type="PackedScene" uid="uid://cm3rixnnev1pg" path="res://objects/jump_pad.tscn" id="8_dt3jb"]
[ext_resource type="PackedScene" uid="uid://to2xnqev0pu1" path="res://objects/cage.tscn" id="9_oiafb"]
[ext_resource type="PackedScene" uid="uid://bd51frym6mm7v" path="res://objects/lever.tscn" id="10_gxrpi"]
[ext_resource type="PackedScene" uid="uid://bwdlmualj6xbw" path="res://objects/entities/enemy.tscn" id="7_qgddg"]
[ext_resource type="PackedScene" uid="uid://cm3rixnnev1pg" path="res://objects/entities/jump_pad.tscn" id="8_dt3jb"]
[ext_resource type="PackedScene" uid="uid://to2xnqev0pu1" path="res://objects/entities/cage.tscn" id="9_oiafb"]
[ext_resource type="PackedScene" uid="uid://bd51frym6mm7v" path="res://objects/entities/lever.tscn" id="10_gxrpi"]
[ext_resource type="Texture2D" uid="uid://cw42lvnqxubq2" path="res://sprites/PS_Tileset_10_nes.png" id="11_cyldw"]
[ext_resource type="Texture2D" uid="uid://dxvevrm15uus1" path="res://sprites/flowers_tileset.png" id="12_hk3do"]
[ext_resource type="PackedScene" uid="uid://12jnkdygpxwc" path="res://objects/exit_level.tscn" id="13_kay4s"]
[ext_resource type="PackedScene" uid="uid://12jnkdygpxwc" path="res://objects/entities/exit_level.tscn" id="13_kay4s"]
[ext_resource type="Script" uid="uid://d23haq52m7ulv" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="13_rsy5s"]
[ext_resource type="Script" uid="uid://ccfft4b8rwgbo" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="14_mjvn7"]
[ext_resource type="PackedScene" uid="uid://dtjrpkhssq32a" path="res://objects/bg.tscn" id="14_ws5fk"]
[ext_resource type="PackedScene" uid="uid://bqom4cm7r18db" path="res://objects/killzone.tscn" id="20_8a4vc"]
[ext_resource type="PackedScene" uid="uid://dlm2ri562fynd" path="res://objects/marketplace.tscn" id="20_ss8k0"]
[ext_resource type="PackedScene" uid="uid://d0s2abysa86rq" path="res://objects/child.tscn" id="21_8rhdx"]
[ext_resource type="PackedScene" uid="uid://bqom4cm7r18db" path="res://objects/entities/killzone.tscn" id="20_8a4vc"]
[ext_resource type="PackedScene" uid="uid://dlm2ri562fynd" path="res://objects/ui/marketplace.tscn" id="20_ss8k0"]
[ext_resource type="PackedScene" uid="uid://d0s2abysa86rq" path="res://objects/entities/child.tscn" id="21_8rhdx"]
[ext_resource type="PackedScene" uid="uid://b4pdt1gv2ymyi" path="res://objects/tooltip.tscn" id="25_ckf05"]
[ext_resource type="PackedScene" uid="uid://i6mnjbjcoqe5" path="res://objects/pause_menu.tscn" id="25_j7bvy"]
[ext_resource type="PackedScene" uid="uid://i6mnjbjcoqe5" path="res://objects/ui/pause_menu.tscn" id="25_j7bvy"]
[ext_resource type="PackedScene" uid="uid://y0ae6e7t70fj" path="res://objects/ui/settings_menu.tscn" id="26_y81of"]
[ext_resource type="PackedScene" uid="uid://cvfsbiy5ggrpg" path="res://objects/ui/input_settings.tscn" id="27_gsk6d"]
[ext_resource type="Script" uid="uid://8r1y8elyw7kt" path="res://scripts/console_management.gd" id="28_1dqgb"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_cagp7"]
texture = ExtResource("1_5lb42")
@@ -583,6 +586,9 @@ components_to_disable = [NodePath("../../Brick Player")]
[node name="Pause menu" parent="CanvasLayer" instance=ExtResource("25_j7bvy")]
visible = false
settings_menu = ExtResource("26_y81of")
[node name="Input Settings" parent="CanvasLayer" instance=ExtResource("27_gsk6d")]
[node name="Killzone" parent="." instance=ExtResource("20_8a4vc")]
position = Vector2(0, 990)
@@ -595,4 +601,10 @@ text = "Press 'down' to fall from platform!"
position = Vector2(1576, -40)
text = "Be careful!"
[node name="ConsoleManagement" type="Node" parent="." node_paths=PackedStringArray("player_health", "skill_unlocker", "skill_manager")]
script = ExtResource("28_1dqgb")
player_health = NodePath("../Brick Player/HealthComponent")
skill_unlocker = NodePath("../Brick Player/SkillUnlockerComponent")
skill_manager = NodePath("../Brick Player/SkillManager")
[editable path="Brick Player"]

17
scripts/achievements.gd Normal file
View File

@@ -0,0 +1,17 @@
class_name Achievements
extends Node
func unlock_achievement(achievement_name: String) -> bool:
if not Steam.setAchievement(achievement_name):
print("Failed to unlock achievement: ", achievement_name)
return false
return true
func reset_achievement(achievement_name: String) -> bool:
if not Steam.clearAchievement(achievement_name):
print("Failed to reset achievement: ", achievement_name)
return false
return true

View File

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

View File

@@ -1,7 +1,7 @@
class_name PeriodicShootingComponent
class_name PeriodicShootingComponent
extends Node
@export var bullet_scene: PackedScene = preload("res://objects/bullet.tscn")
@export var bullet_scene: PackedScene = preload("res://objects/entities/bullet.tscn")
@export var shoot_interval: float = 1.0
@export var shoot_direction: Vector2 = Vector2.RIGHT
@export var side_to_side_movement: SideToSideMovement

View File

@@ -22,8 +22,7 @@ func try_unlock_skill(skill_data: SkillData) -> bool:
return true
func _input(event: InputEvent) -> void:
if event.is_action_pressed("unlock_skills"):
func unlock_all_skills() -> void:
var available_skills: Array[SkillData] = skill_manager.available_skills
var skills: Array[String] = []
@@ -32,4 +31,8 @@ func _input(event: InputEvent) -> void:
game_manager.unlock_skills(skills)
skill_manager.apply_unlocked_skills()
print("Unlocked skills: ", skills)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("unlock_skills"):
unlock_all_skills()

View File

@@ -0,0 +1,134 @@
class_name ConsoleManagement
extends Node
@export var player_health: HealthComponent
@export var skill_unlocker: SkillUnlockerComponent
@export var skill_manager: SkillManager
@onready var game_manager: GM = $"/root/GameManager"
@onready var achievements: Achievements = $"/root/AchievementsManager"
func _ready() -> void:
Console.pause_enabled = true
Console.add_command("add_coins", console_add_coins, ["amount"], 1, "Add coins to the player.")
Console.add_command("set_coins", console_set_coins, ["amount"], 1, "Set the player's coins.")
Console.add_command("set_lives", console_set_lives, ["amount"], 1, "Set the player's lives.")
Console.add_command("set_health", console_set_health, ["amount"], 1, "Set the player's health.")
Console.add_command("unlock_skill", console_unlock_skill, ["skill_name"], 1, "Unlock a skill for the player.")
Console.add_command("remove_skill", console_remove_skill, ["skill_name"], 1, "Remove a skill from the player.")
Console.add_command("remove_all_skills", console_remove_all_skills, [], 0, "Remove all skills from the player.")
Console.add_command("unlock_all_skills", console_unlock_all_skills, [], 0, "Unlock all skills for the player.")
Console.add_command("unlock_achievement", console_unlock_achievement, ["achievement_name"], 1, "Unlock an achievement for the player.")
Console.add_command("reset_achievement", console_reset_achievement, ["achievement_name"], 1, "Reset an achievement for the player.")
func console_add_coins(amount: Variant) -> void:
if not game_manager:
return
if not amount.is_valid_int():
Console.print_error("Invalid amount: " + str(amount))
return
game_manager.add_coins(int(amount))
Console.print_info("Added " + str(amount) + " coins.")
func console_set_coins(amount: Variant) -> void:
if not game_manager:
return
if not amount.is_valid_int():
Console.print_error("Invalid amount: " + str(amount))
return
game_manager.set_coins(int(amount))
Console.print_info("Set coins to " + str(amount))
func console_set_lives(amount: Variant) -> void:
if not game_manager:
return
if not amount.is_valid_int():
Console.print_error("Invalid amount: " + str(amount))
return
game_manager.set_lives(int(amount))
Console.print_info("Set lives to " + str(amount))
func console_set_health(amount: Variant) -> void:
if not player_health:
return
if not amount.is_valid_int():
Console.print_error("Invalid amount: " + str(amount))
return
player_health.set_health(int(amount))
Console.print_info("Set health to " + str(amount))
func console_unlock_skill(skill_name: Variant) -> void:
if not skill_manager or not skill_unlocker or not game_manager:
return
if not skill_name:
Console.print_error("Invalid skill name: " + str(skill_name))
return
game_manager.unlock_skill(skill_name)
var skill_data: SkillData = skill_manager.get_skill_by_name(skill_name)
if not skill_data:
Console.print_error("Skill not found: " + str(skill_name))
return
skill_manager.add_skill(skill_data)
Console.print_info("Unlocked skill: " + str(skill_name))
func console_unlock_all_skills() -> void:
if not skill_manager or not skill_unlocker or not game_manager:
return
skill_unlocker.unlock_all_skills()
Console.print_info("Unlocked all skills.")
func console_remove_skill(skill_name: Variant) -> void:
if not skill_manager or not skill_unlocker or not game_manager:
return
if not skill_name:
Console.print_error("Invalid skill name: " + str(skill_name))
return
game_manager.remove_skill(skill_name)
skill_manager.remove_skill(skill_name)
Console.print_info("Removed skill: " + str(skill_name))
func console_remove_all_skills() -> void:
if not skill_manager or not skill_unlocker or not game_manager:
return
for skill_name in skill_manager.active_components.keys():
game_manager.remove_skill(skill_name)
skill_manager.remove_skill(skill_name)
func console_unlock_achievement(achievement_name: Variant) -> void:
if not achievement_name:
Console.print_error("Invalid achievement name: " + str(achievement_name))
return
if not achievements:
Console.print_error("Achievements manager not found.")
return
if not achievements.unlock_achievement(achievement_name):
Console.print_error("Failed to unlock achievement: " + str(achievement_name))
Console.print_info("Unlocked achievement: " + str(achievement_name))
func console_reset_achievement(achievement_name: Variant) -> void:
if not achievement_name:
Console.print_error("Invalid achievement name: " + str(achievement_name))
return
if not achievements:
Console.print_error("Achievements manager not found.")
return
if not achievements.reset_achievement(achievement_name):
Console.print_error("Failed to reset achievement: " + str(achievement_name))
Console.print_info("Reset achievement: " + str(achievement_name))

View File

@@ -0,0 +1 @@
uid://8r1y8elyw7kt

View File

@@ -103,6 +103,11 @@ func unlock_skill(skill_name: String) -> void:
player_state["unlocked_skills"].append(skill_name)
func remove_skill(skill_name: String) -> void:
if is_skill_unlocked(skill_name):
player_state["unlocked_skills"].erase(skill_name)
func unlock_skills(skill_names: Array[String]) -> void:
for skill_name in skill_names:
unlock_skill(skill_name)

99
scripts/input_settings.gd Normal file
View File

@@ -0,0 +1,99 @@
class_name InputSettings
extends Control
@export var input_button_scene: PackedScene = preload("res://objects/ui/input_button.tscn")
@export var action_list: Container
@export var reset_to_default_button: Button
@export var input_actions: Dictionary = {
'left': 'Move left',
'right': 'Move right',
'up': 'Move up',
'down': 'Move down',
'jump': 'Jump',
'attack': 'Attack',
'show_marketplace': "Toggle marketplace",
}
var is_remapping: bool = false
var action_to_remap = null
var remapping_button = null
var buttons: Array[Button] = []
@onready var config_file_handler = $'/root/ConfigFileHandler'
func _ready() -> void:
create_action_list()
if buttons.size() > 0:
buttons[0].grab_focus()
if reset_to_default_button:
reset_to_default_button.pressed.connect(on_reset_button_pressed)
func _input(event: InputEvent) -> void:
if is_remapping:
if event is InputEventKey or (event is InputEventMouseButton and event.pressed) or event is InputEventJoypadButton:
if event is InputEventMouseButton and event.double_click:
event.double_click = false
InputMap.action_erase_events(action_to_remap)
InputMap.action_add_event(action_to_remap, event)
update_action_list(remapping_button, event)
is_remapping = false
action_to_remap = null
remapping_button = null
accept_event()
func create_action_list() -> void:
InputMap.load_from_project_settings()
for item in action_list.get_children():
item.queue_free()
for action in input_actions:
var button := input_button_scene.instantiate() as Button
var action_label := button.find_child("LabelAction") as Label
var input_label := button.find_child("LabelInput") as Label
action_label.text = input_actions[action]
var events := InputMap.action_get_events(action)
if events.size() > 0:
input_label.text = events[0].as_text().trim_suffix(" (Physical)")
else:
input_label.text = "None"
action_list.add_child(button)
button.pressed.connect(on_input_button_pressed.bind(button, action))
buttons.append(button)
func on_input_button_pressed(button: Button, action) -> void:
if is_remapping:
return
is_remapping = true
action_to_remap = action
remapping_button = button
button.find_child("LabelInput").text = "Press any key..."
func update_action_list(button: Button, event: InputEvent) -> void:
button.find_child("LabelInput").text = event.as_text().trim_suffix(" (Physical)")
func on_reset_button_pressed() -> void:
create_action_list()
func save_settings() -> void:
config_file_handler.settings_config.set_value("input_settings", "input_actions", input_actions)
config_file_handler.settings_config.save(config_file_handler.SETTINGS_FILE_PATH)
func load_settings() -> void:
pass

View File

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

View File

@@ -13,6 +13,7 @@ extends Node
var is_paused: bool = false
var is_console_open: bool = false
var settings_menu_instance: Control
func _ready() -> void:
@@ -42,6 +43,8 @@ func _ready() -> void:
quit_button.pressed.connect(_on_quit_button_pressed)
settings_button.pressed.connect(_on_settings_button_pressed)
exit_to_menu_button.pressed.connect(_on_exit_to_menu_button_pressed)
Console.console_opened.connect(_on_console_open)
Console.console_closed.connect(_on_console_close)
func _input(event: InputEvent) -> void:
@@ -57,6 +60,9 @@ func _input(event: InputEvent) -> void:
func _on_resume_button_pressed() -> void:
pause_menu_control.hide()
if settings_menu_instance:
settings_menu_instance.queue_free()
settings_menu_instance = null
gm.resume_game()
is_paused = false
@@ -71,9 +77,9 @@ func _on_settings_button_pressed() -> void:
return
var settings_instance: Control = settings_menu.instantiate()
get_tree().root.add_child(settings_instance)
add_child(settings_instance)
settings_instance.show()
pause_menu_control.hide()
settings_menu_instance = settings_instance
gm.pause_game()
is_paused = true
@@ -87,8 +93,8 @@ func _on_exit_to_menu_button_pressed() -> void:
func _on_console_open():
pass
is_console_open = true
func _on_console_close():
pass
is_console_open = false

8
scripts/settings_menu.gd Normal file
View File

@@ -0,0 +1,8 @@
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

View File

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

View File

@@ -55,3 +55,10 @@ func apply_unlocked_skills() -> void:
add_skill(skill_data)
else:
remove_skill(skill_data.name)
func get_skill_by_name(skill_name: String) -> SkillData:
for skill_data in available_skills:
if skill_data.name == skill_name:
return skill_data
return null

BIN
sprites/ppc_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://jix7wdn0isr3"
path="res://.godot/imported/ppc_icon.png-8145cd02217fb17a919a08d0c10aaf20.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ppc_icon.png"
dest_files=["res://.godot/imported/ppc_icon.png-8145cd02217fb17a919a08d0c10aaf20.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