diff --git a/addons/console/console.gd b/addons/console/console.gd index db80f09..c9632b7 100644 --- a/addons/console/console.gd +++ b/addons/console/console.gd @@ -1,21 +1,22 @@ extends Node -var enabled := true -var enable_on_release_build := false : set = set_enable_on_release_build -var pause_enabled := false - +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 class ConsoleCommand: - var function : Callable - var arguments : PackedStringArray - var required : int - var description : String - var hidden : bool - func _init(in_function : Callable, in_arguments : PackedStringArray, in_required : int = 0, in_description : String = ""): + var function: Callable + var arguments: PackedStringArray + 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 required = in_required @@ -23,49 +24,48 @@ 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 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 +var was_paused_already := false + ## Usage: Console.add_command("command_name", , , , "Help description") -func add_command(command_name : String, function : Callable, arguments = [], required: int = 0, description : String = "") -> void: +func add_command(command_name: String, function: Callable, arguments = [], required: int = 0, description: String = "") -> void: if (arguments is int): # Legacy call using an argument number - var param_array : PackedStringArray + var param_array: PackedStringArray for i in range(arguments): param_array.append("arg_" + str(i + 1)) console_commands[command_name] = ConsoleCommand.new(function, param_array, required, description) elif (arguments is Array): # New array argument system - var str_args : PackedStringArray + var str_args: PackedStringArray for argument in arguments: str_args.append(str(argument)) console_commands[command_name] = ConsoleCommand.new(function, str_args, required, description) ## Adds a secret command that will not show up in the help or auto-complete. -func add_hidden_command(command_name : String, function : Callable, arguments = [], required : int = 0) -> void: +func add_hidden_command(command_name: String, function: Callable, arguments = [], required: int = 0) -> void: add_command(command_name, function, arguments, required) console_commands[command_name].hidden = true ## Removes a command from the console. This should be called on a script's _exit_tree() ## if you have console commands for things that are unloaded before the project closes. -func remove_command(command_name : String) -> void: +func remove_command(command_name: String) -> void: console_commands.erase(command_name) command_parameters.erase(command_name) ## Useful if you have a list of possible parameters (ex: level names). -func add_command_autocomplete_list(command_name : String, param_list : PackedStringArray): +func add_command_autocomplete_list(command_name: String, param_list: PackedStringArray): command_parameters[command_name] = param_list @@ -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 @@ -108,7 +108,7 @@ func _enter_tree() -> void: func _exit_tree() -> void: var console_history_file := FileAccess.open("user://console_history.txt", FileAccess.WRITE) if (console_history_file): - var write_index := 0 + var write_index := 0 var start_write_index := console_history.size() - 100 # Max lines to write for line in console_history: if (write_index >= start_write_index): @@ -133,7 +133,8 @@ 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: + +func _input(event: InputEvent) -> void: if (event is InputEventKey): if (event.get_physical_keycode_with_modifiers() == KEY_QUOTELEFT): # ~ key. if (event.pressed): @@ -173,22 +174,23 @@ func _input(event : InputEvent) -> void: reset_autocomplete() if (event.get_physical_keycode_with_modifiers() == KEY_PAGEUP): var scroll := rich_label.get_v_scroll_bar() - var tween := create_tween() - tween.tween_property(scroll, "value", scroll.value - (scroll.page - scroll.page * 0.1), 0.1) + var tween := create_tween() + tween.tween_property(scroll, "value", scroll.value - (scroll.page - scroll.page * 0.1), 0.1) get_tree().get_root().set_input_as_handled() if (event.get_physical_keycode_with_modifiers() == KEY_PAGEDOWN): var scroll := rich_label.get_v_scroll_bar() - var tween := create_tween() - tween.tween_property(scroll, "value", scroll.value + (scroll.page - scroll.page * 0.1), 0.1) + var tween := create_tween() + tween.tween_property(scroll, "value", scroll.value + (scroll.page - scroll.page * 0.1), 0.1) get_tree().get_root().set_input_as_handled() if (event.get_physical_keycode_with_modifiers() == KEY_TAB): autocomplete() get_tree().get_root().set_input_as_handled() -var suggestions := [] +var suggestions := [] var current_suggest := 0 -var suggesting := false +var suggesting := false + func autocomplete() -> void: if (suggesting): @@ -203,11 +205,11 @@ func autocomplete() -> void: return else: suggesting = true - + if (" " in line_edit.text): # We're searching for a parameter to autocomplete var split_text := parse_line_input(line_edit.text) if (split_text.size() > 1): - var command := split_text[0] + var command := split_text[0] var param_input := split_text[1] if (command_parameters.has(command)): for param in command_parameters[command]: @@ -220,11 +222,11 @@ func autocomplete() -> void: sorted_commands.append(str(command)) sorted_commands.sort() sorted_commands.reverse() - + var prev_index := 0 for command in sorted_commands: if (!line_edit.text || command.contains(line_edit.text)): - var index : int = command.find(line_edit.text) + var index: int = command.find(line_edit.text) if (index <= prev_index): suggestions.push_front(command) else: @@ -284,23 +286,25 @@ func scroll_to_bottom() -> void: scroll.value = scroll.max_value - scroll.page -func print_error(text : Variant, print_godot := false) -> void: +func print_error(text: Variant, print_godot := false) -> void: if not text is String: text = str(text) print_line("[color=light_coral] ERROR:[/color] %s" % text, print_godot) -func print_info(text : Variant, print_godot := false) -> void: + +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: + + +func print_warning(text: Variant, print_godot := false) -> void: if not text is String: text = str(text) print_line("[color=gold] WARNING:[/color] %s" % text, print_godot) -func print_line(text : Variant, print_godot := false) -> void: +func print_line(text: Variant, print_godot := false) -> void: if not text is String: text = str(text) if (!rich_label): # Tried to print something before the console was loaded. @@ -312,12 +316,12 @@ func print_line(text : Variant, print_godot := false) -> void: print(text) -func parse_line_input(text : String) -> PackedStringArray: - var out_array : PackedStringArray +func parse_line_input(text: String) -> PackedStringArray: + var out_array: PackedStringArray var first_char := true - var in_quotes := false - var escaped := false - var token : String + var in_quotes := false + var escaped := false + var token: String for c in text: if (c == '\\'): escaped = true @@ -349,23 +353,23 @@ func parse_line_input(text : String) -> PackedStringArray: return out_array -func on_text_entered(new_text : String) -> void: +func on_text_entered(new_text: String) -> void: scroll_to_bottom() reset_autocomplete() line_edit.clear() if (line_edit.has_method(&"edit")): line_edit.call_deferred(&"edit") - + if not new_text.strip_edges().is_empty(): add_input_history(new_text) print_line("[i]> " + new_text + "[/i]") - var text_split := parse_line_input(new_text) + var text_split := parse_line_input(new_text) var text_command := text_split[0] - + if console_commands.has(text_command): - var arguments := text_split.slice(1) - var console_command : ConsoleCommand = console_commands[text_command] - + var arguments := text_split.slice(1) + var console_command: ConsoleCommand = console_commands[text_command] + # calc is a especial command that needs special treatment if (text_command.match("calc")): var expression := "" @@ -390,7 +394,7 @@ func on_text_entered(new_text : String) -> void: print_error("Command not found.") -func on_line_edit_text_changed(new_text : String) -> void: +func on_line_edit_text_changed(new_text: String) -> void: reset_autocomplete() @@ -409,30 +413,51 @@ func delete_history() -> void: func help() -> void: - rich_label.append_text(" Built in commands: + rich_label.append_text(" Built in commands: [color=light_green]calc[/color]: Calculates a given expresion - [color=light_green]clear[/color]: Clears the registry view - [color=light_green]commands[/color]: Shows a reduced list of all the currently registered commands - [color=light_green]commands_list[/color]: Shows a detailed list of all the currently registered commands - [color=light_green]delete_history[/color]: Deletes the commands history - [color=light_green]echo[/color]: Prints a given string to the console - [color=light_green]echo_error[/color]: Prints a given string as an error to the console - [color=light_green]echo_info[/color]: Prints a given string as info to the console - [color=light_green]echo_warning[/color]: Prints a given string as warning to the console - [color=light_green]pause[/color]: Pauses node processing - [color=light_green]unpause[/color]: Unpauses node processing - [color=light_green]quit[/color]: Quits the game - Controls: - [color=light_blue]Up[/color] and [color=light_blue]Down[/color] arrow keys to navigate commands history - [color=light_blue]PageUp[/color] and [color=light_blue]PageDown[/color] to scroll registry - [[color=light_blue]Ctrl[/color] + [color=light_blue]~[/color]] to change console size between half screen and full screen - [color=light_blue]~[/color] or [color=light_blue]Esc[/color] key to close the console - [color=light_blue]Tab[/color] key to autocomplete, [color=light_blue]Tab[/color] again to cycle between matching suggestions\n\n") +[color=light_green]clear[/color]: Clears the registry view +[color=light_green]commands[/color]: Shows a reduced list of all the currently registered commands +[color=light_green]commands_list[/color]: Shows a detailed list of all the currently registered commands +[color=light_green]delete_history[/color]: Deletes the commands history +[color=light_green]echo[/color]: Prints a given string to the console +[color=light_green]echo_error[/color]: Prints a given string as an error to the console +[color=light_green]echo_info[/color]: Prints a given string as info to the console +[color=light_green]echo_warning[/color]: Prints a given string as warning to the console +[color=light_green]pause[/color]: Pauses node processing +[color=light_green]unpause[/color]: Unpauses node processing +[color=light_green]quit[/color]: Quits the game +Controls: +[color=light_blue]Up[/color] and [color=light_blue]Down[/color] arrow keys to navigate commands history +[color=light_blue]PageUp[/color] and [color=light_blue]PageDown[/color] to scroll registry +[[color=light_blue]Ctrl[/color] + [color=light_blue]~[/color]] to change console size between half screen and full screen +[color=light_blue]~[/color] or [color=light_blue]Esc[/color] key to close the console +[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: + + + + + + + + + + + + + + + + + + + + + +func calculate(command: String) -> void: var expression := Expression.new() - var error = expression.parse(command) + var error = expression.parse(command) if error: print_error("%s" % expression.get_error_text()) return @@ -459,10 +484,10 @@ func commands_list() -> void: if (!console_commands[command].hidden): commands.append(str(command)) commands.sort() - + for command in commands: - var arguments_string := "" - var description : String = console_commands[command].description + var arguments_string := "" + var description: String = console_commands[command].description for i in range(console_commands[command].arguments.size()): if i < console_commands[command].required: arguments_string += " [color=cornflower_blue]<" + console_commands[command].arguments[i] + ">[/color]" @@ -472,13 +497,13 @@ func commands_list() -> void: rich_label.append_text("\n") -func add_input_history(text : String) -> void: +func add_input_history(text: String) -> void: if (!console_history.size() || text != console_history.back()): # Don't add consecutive duplicates console_history.append(text) console_history_index = console_history.size() -func set_enable_on_release_build(enable : bool): +func set_enable_on_release_build(enable: bool): enable_on_release_build = enable if (!enable_on_release_build): if (!OS.is_debug_build()): @@ -487,12 +512,14 @@ 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] + + +func exec(filename: String) -> void: + var path := "user://%s.txt" % [filename] var script := FileAccess.open(path, FileAccess.READ) if (script): while (!script.eof_reached()): diff --git a/autoloads/config_file_handler.gd b/autoloads/config_file_handler.gd new file mode 100644 index 0000000..06daad3 --- /dev/null +++ b/autoloads/config_file_handler.gd @@ -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) \ No newline at end of file diff --git a/autoloads/config_file_handler.gd.uid b/autoloads/config_file_handler.gd.uid new file mode 100644 index 0000000..10aaa99 --- /dev/null +++ b/autoloads/config_file_handler.gd.uid @@ -0,0 +1 @@ +uid://dueoywjgtwv7m diff --git a/export_presets.cfg b/export_presets.cfg index 888be33..226fc9e 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -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="" diff --git a/objects/achievements.tscn b/objects/achievements.tscn new file mode 100644 index 0000000..85d568b --- /dev/null +++ b/objects/achievements.tscn @@ -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") diff --git a/objects/big_coin.tscn b/objects/entities/big_coin.tscn similarity index 100% rename from objects/big_coin.tscn rename to objects/entities/big_coin.tscn diff --git a/objects/big_treasure.tscn b/objects/entities/big_treasure.tscn similarity index 100% rename from objects/big_treasure.tscn rename to objects/entities/big_treasure.tscn diff --git a/objects/brick.tscn b/objects/entities/brick.tscn similarity index 100% rename from objects/brick.tscn rename to objects/entities/brick.tscn diff --git a/objects/brick_player.tscn b/objects/entities/brick_player.tscn similarity index 99% rename from objects/brick_player.tscn rename to objects/entities/brick_player.tscn index 6e48c7a..a3fc701 100644 --- a/objects/brick_player.tscn +++ b/objects/entities/brick_player.tscn @@ -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"] diff --git a/objects/bullet.tscn b/objects/entities/bullet.tscn similarity index 100% rename from objects/bullet.tscn rename to objects/entities/bullet.tscn diff --git a/objects/cage.tscn b/objects/entities/cage.tscn similarity index 100% rename from objects/cage.tscn rename to objects/entities/cage.tscn diff --git a/objects/cannon.tscn b/objects/entities/cannon.tscn similarity index 100% rename from objects/cannon.tscn rename to objects/entities/cannon.tscn diff --git a/objects/cannon_ray_down.tscn b/objects/entities/cannon_ray_down.tscn similarity index 100% rename from objects/cannon_ray_down.tscn rename to objects/entities/cannon_ray_down.tscn diff --git a/objects/cannon_ray_left.tscn b/objects/entities/cannon_ray_left.tscn similarity index 100% rename from objects/cannon_ray_left.tscn rename to objects/entities/cannon_ray_left.tscn diff --git a/objects/child.tscn b/objects/entities/child.tscn similarity index 100% rename from objects/child.tscn rename to objects/entities/child.tscn diff --git a/objects/coin.tscn b/objects/entities/coin.tscn similarity index 100% rename from objects/coin.tscn rename to objects/entities/coin.tscn diff --git a/objects/collapsing_bridge.tscn b/objects/entities/collapsing_bridge.tscn similarity index 100% rename from objects/collapsing_bridge.tscn rename to objects/entities/collapsing_bridge.tscn diff --git a/objects/enemy.tscn b/objects/entities/enemy.tscn similarity index 98% rename from objects/enemy.tscn rename to objects/entities/enemy.tscn index 1ffa24e..cc0d948 100644 --- a/objects/enemy.tscn +++ b/objects/entities/enemy.tscn @@ -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) diff --git a/objects/exit_level.tscn b/objects/entities/exit_level.tscn similarity index 100% rename from objects/exit_level.tscn rename to objects/entities/exit_level.tscn diff --git a/objects/exploding_brick.tscn b/objects/entities/exploding_brick.tscn similarity index 97% rename from objects/exploding_brick.tscn rename to objects/entities/exploding_brick.tscn index 12925b2..36d1002 100644 --- a/objects/exploding_brick.tscn +++ b/objects/entities/exploding_brick.tscn @@ -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) diff --git a/objects/fire_brick.tscn b/objects/entities/fire_brick.tscn similarity index 100% rename from objects/fire_brick.tscn rename to objects/entities/fire_brick.tscn diff --git a/objects/ice_brick.tscn b/objects/entities/ice_brick.tscn similarity index 100% rename from objects/ice_brick.tscn rename to objects/entities/ice_brick.tscn diff --git a/objects/jump_pad.tscn b/objects/entities/jump_pad.tscn similarity index 100% rename from objects/jump_pad.tscn rename to objects/entities/jump_pad.tscn diff --git a/objects/killzone.tscn b/objects/entities/killzone.tscn similarity index 100% rename from objects/killzone.tscn rename to objects/entities/killzone.tscn diff --git a/objects/laser_beam.tscn b/objects/entities/laser_beam.tscn similarity index 100% rename from objects/laser_beam.tscn rename to objects/entities/laser_beam.tscn diff --git a/objects/lever.tscn b/objects/entities/lever.tscn similarity index 100% rename from objects/lever.tscn rename to objects/entities/lever.tscn diff --git a/objects/treasure.tscn b/objects/entities/treasure.tscn similarity index 100% rename from objects/treasure.tscn rename to objects/entities/treasure.tscn diff --git a/objects/explosion_fx.tscn b/objects/fxs/explosion_fx.tscn similarity index 100% rename from objects/explosion_fx.tscn rename to objects/fxs/explosion_fx.tscn diff --git a/objects/fire_fx.tscn b/objects/fxs/fire_fx.tscn similarity index 100% rename from objects/fire_fx.tscn rename to objects/fxs/fire_fx.tscn diff --git a/objects/ice_fx.tscn b/objects/fxs/ice_fx.tscn similarity index 100% rename from objects/ice_fx.tscn rename to objects/fxs/ice_fx.tscn diff --git a/objects/level/village/entities_layer.tscn b/objects/level/village/entities_layer.tscn index 8a87fd2..6c16dbd 100644 --- a/objects/level/village/entities_layer.tscn +++ b/objects/level/village/entities_layer.tscn @@ -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") diff --git a/objects/player_skills/brick_throw_skill.tscn b/objects/player_skills/brick_throw_skill.tscn index 44137a8..983d777 100644 --- a/objects/player_skills/brick_throw_skill.tscn +++ b/objects/player_skills/brick_throw_skill.tscn @@ -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") diff --git a/objects/hud.tscn b/objects/ui/hud.tscn similarity index 100% rename from objects/hud.tscn rename to objects/ui/hud.tscn diff --git a/objects/ui/input_button.tscn b/objects/ui/input_button.tscn new file mode 100644 index 0000000..9cd4c7f --- /dev/null +++ b/objects/ui/input_button.tscn @@ -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 diff --git a/objects/ui/input_settings.tscn b/objects/ui/input_settings.tscn new file mode 100644 index 0000000..8c705de --- /dev/null +++ b/objects/ui/input_settings.tscn @@ -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 diff --git a/objects/marketplace.tscn b/objects/ui/marketplace.tscn similarity index 98% rename from objects/marketplace.tscn rename to objects/ui/marketplace.tscn index 63dcafa..083ba4a 100644 --- a/objects/marketplace.tscn +++ b/objects/ui/marketplace.tscn @@ -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) diff --git a/objects/marketplace_button.tscn b/objects/ui/marketplace_button.tscn similarity index 100% rename from objects/marketplace_button.tscn rename to objects/ui/marketplace_button.tscn diff --git a/objects/pause_menu.tscn b/objects/ui/pause_menu.tscn similarity index 100% rename from objects/pause_menu.tscn rename to objects/ui/pause_menu.tscn diff --git a/objects/ui/settings_menu.tscn b/objects/ui/settings_menu.tscn new file mode 100644 index 0000000..b02f61c --- /dev/null +++ b/objects/ui/settings_menu.tscn @@ -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 diff --git a/project.godot b/project.godot index 8697f4e..92f8b78 100644 --- a/project.godot +++ b/project.godot @@ -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 diff --git a/resources/skills/explosive_brick.tres b/resources/skills/explosive_brick.tres index d04ba5d..177d8ad 100644 --- a/resources/skills/explosive_brick.tres +++ b/resources/skills/explosive_brick.tres @@ -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"] diff --git a/resources/skills/fire_brick.tres b/resources/skills/fire_brick.tres index a883c87..7966566 100644 --- a/resources/skills/fire_brick.tres +++ b/resources/skills/fire_brick.tres @@ -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"] diff --git a/resources/skills/ice_brick.tres b/resources/skills/ice_brick.tres index 0272f8d..39e6821 100644 --- a/resources/skills/ice_brick.tres +++ b/resources/skills/ice_brick.tres @@ -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"] diff --git a/scenes/test.tscn b/scenes/test.tscn index 424dbd7..55bd0d4 100644 --- a/scenes/test.tscn +++ b/scenes/test.tscn @@ -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"] diff --git a/scripts/achievements.gd b/scripts/achievements.gd new file mode 100644 index 0000000..ae4735b --- /dev/null +++ b/scripts/achievements.gd @@ -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 \ No newline at end of file diff --git a/scripts/achievements.gd.uid b/scripts/achievements.gd.uid new file mode 100644 index 0000000..107a087 --- /dev/null +++ b/scripts/achievements.gd.uid @@ -0,0 +1 @@ +uid://deguukal87gcb diff --git a/scripts/components/periodic_shooting.gd b/scripts/components/periodic_shooting.gd index 5251382..e65b800 100644 --- a/scripts/components/periodic_shooting.gd +++ b/scripts/components/periodic_shooting.gd @@ -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 @@ -45,4 +45,4 @@ func setup_timer() -> void: timer.one_shot = false timer.autostart = true timer.timeout.connect(on_timer_timeout) - add_child(timer) \ No newline at end of file + add_child(timer) diff --git a/scripts/components/skill_unlocker_component.gd b/scripts/components/skill_unlocker_component.gd index 82b9428..95c4029 100644 --- a/scripts/components/skill_unlocker_component.gd +++ b/scripts/components/skill_unlocker_component.gd @@ -22,14 +22,17 @@ func try_unlock_skill(skill_data: SkillData) -> bool: return true +func unlock_all_skills() -> void: + var available_skills: Array[SkillData] = skill_manager.available_skills + var skills: Array[String] = [] + + for skill in available_skills: + skills.append(skill.name) + + game_manager.unlock_skills(skills) + skill_manager.apply_unlocked_skills() + + func _input(event: InputEvent) -> void: if event.is_action_pressed("unlock_skills"): - var available_skills: Array[SkillData] = skill_manager.available_skills - var skills: Array[String] = [] - - for skill in available_skills: - skills.append(skill.name) - - game_manager.unlock_skills(skills) - skill_manager.apply_unlocked_skills() - print("Unlocked skills: ", skills) + unlock_all_skills() \ No newline at end of file diff --git a/scripts/console_management.gd b/scripts/console_management.gd new file mode 100644 index 0000000..08e634c --- /dev/null +++ b/scripts/console_management.gd @@ -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)) diff --git a/scripts/console_management.gd.uid b/scripts/console_management.gd.uid new file mode 100644 index 0000000..85e0f88 --- /dev/null +++ b/scripts/console_management.gd.uid @@ -0,0 +1 @@ +uid://8r1y8elyw7kt diff --git a/scripts/game_manager.gd b/scripts/game_manager.gd index a83871c..d394d98 100644 --- a/scripts/game_manager.gd +++ b/scripts/game_manager.gd @@ -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) diff --git a/scripts/input_settings.gd b/scripts/input_settings.gd new file mode 100644 index 0000000..f2c6d6d --- /dev/null +++ b/scripts/input_settings.gd @@ -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 \ No newline at end of file diff --git a/scripts/input_settings.gd.uid b/scripts/input_settings.gd.uid new file mode 100644 index 0000000..f8b32f3 --- /dev/null +++ b/scripts/input_settings.gd.uid @@ -0,0 +1 @@ +uid://dppwl7xie2mh diff --git a/scripts/pause_menu.gd b/scripts/pause_menu.gd index 41322ef..ecaa130 100644 --- a/scripts/pause_menu.gd +++ b/scripts/pause_menu.gd @@ -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 \ No newline at end of file + is_console_open = false diff --git a/scripts/settings_menu.gd b/scripts/settings_menu.gd new file mode 100644 index 0000000..8e11a35 --- /dev/null +++ b/scripts/settings_menu.gd @@ -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 \ No newline at end of file diff --git a/scripts/settings_menu.gd.uid b/scripts/settings_menu.gd.uid new file mode 100644 index 0000000..b3580c5 --- /dev/null +++ b/scripts/settings_menu.gd.uid @@ -0,0 +1 @@ +uid://c506rigcjlm6x diff --git a/scripts/skill_manager.gd b/scripts/skill_manager.gd index 1be0ee7..0589725 100644 --- a/scripts/skill_manager.gd +++ b/scripts/skill_manager.gd @@ -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 diff --git a/sprites/ppc_icon.png b/sprites/ppc_icon.png new file mode 100644 index 0000000..968abba Binary files /dev/null and b/sprites/ppc_icon.png differ diff --git a/sprites/ppc_icon.png.import b/sprites/ppc_icon.png.import new file mode 100644 index 0000000..fb5a56e --- /dev/null +++ b/sprites/ppc_icon.png.import @@ -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