Refactor console and scene structure; update resource paths and add configuration handling
This commit is contained in:
@@ -1,21 +1,22 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
var enabled := true
|
var enabled := true
|
||||||
var enable_on_release_build := false : set = set_enable_on_release_build
|
var enable_on_release_build := false: set = set_enable_on_release_build
|
||||||
var pause_enabled := false
|
var pause_enabled := false
|
||||||
|
|
||||||
signal console_opened
|
signal console_opened
|
||||||
signal console_closed
|
signal console_closed
|
||||||
signal console_unknown_command
|
signal console_unknown_command
|
||||||
|
|
||||||
|
|
||||||
class ConsoleCommand:
|
class ConsoleCommand:
|
||||||
var function : Callable
|
var function: Callable
|
||||||
var arguments : PackedStringArray
|
var arguments: PackedStringArray
|
||||||
var required : int
|
var required: int
|
||||||
var description : String
|
var description: String
|
||||||
var hidden : bool
|
var hidden: bool
|
||||||
func _init(in_function : Callable, in_arguments : PackedStringArray, in_required : int = 0, in_description : String = ""):
|
|
||||||
|
|
||||||
|
func _init(in_function: Callable, in_arguments: PackedStringArray, in_required: int = 0, in_description: String = ""):
|
||||||
function = in_function
|
function = in_function
|
||||||
arguments = in_arguments
|
arguments = in_arguments
|
||||||
required = in_required
|
required = in_required
|
||||||
@@ -23,49 +24,48 @@ class ConsoleCommand:
|
|||||||
|
|
||||||
|
|
||||||
var control := Control.new()
|
var control := Control.new()
|
||||||
|
|
||||||
# If you want to customize the way the console looks, you can direcly modify
|
# If you want to customize the way the console looks, you can direcly modify
|
||||||
# the properties of the rich text and line edit here:
|
# the properties of the rich text and line edit here:
|
||||||
var rich_label := RichTextLabel.new()
|
var rich_label := RichTextLabel.new()
|
||||||
var line_edit := LineEdit.new()
|
var line_edit := LineEdit.new()
|
||||||
|
var console_commands := {}
|
||||||
var console_commands := {}
|
var command_parameters := {}
|
||||||
var command_parameters := {}
|
var console_history := []
|
||||||
var console_history := []
|
|
||||||
var console_history_index := 0
|
var console_history_index := 0
|
||||||
var was_paused_already := false
|
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")
|
## 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:
|
func add_command(command_name: String, function: Callable, arguments = [], required: int = 0, description: String = "") -> void:
|
||||||
if (arguments is int):
|
if (arguments is int):
|
||||||
# Legacy call using an argument number
|
# Legacy call using an argument number
|
||||||
var param_array : PackedStringArray
|
var param_array: PackedStringArray
|
||||||
for i in range(arguments):
|
for i in range(arguments):
|
||||||
param_array.append("arg_" + str(i + 1))
|
param_array.append("arg_" + str(i + 1))
|
||||||
console_commands[command_name] = ConsoleCommand.new(function, param_array, required, description)
|
console_commands[command_name] = ConsoleCommand.new(function, param_array, required, description)
|
||||||
elif (arguments is Array):
|
elif (arguments is Array):
|
||||||
# New array argument system
|
# New array argument system
|
||||||
var str_args : PackedStringArray
|
var str_args: PackedStringArray
|
||||||
for argument in arguments:
|
for argument in arguments:
|
||||||
str_args.append(str(argument))
|
str_args.append(str(argument))
|
||||||
console_commands[command_name] = ConsoleCommand.new(function, str_args, required, description)
|
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.
|
## 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)
|
add_command(command_name, function, arguments, required)
|
||||||
console_commands[command_name].hidden = true
|
console_commands[command_name].hidden = true
|
||||||
|
|
||||||
|
|
||||||
## Removes a command from the console. This should be called on a script's _exit_tree()
|
## 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.
|
## 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)
|
console_commands.erase(command_name)
|
||||||
command_parameters.erase(command_name)
|
command_parameters.erase(command_name)
|
||||||
|
|
||||||
|
|
||||||
## Useful if you have a list of possible parameters (ex: level names).
|
## 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
|
command_parameters[command_name] = param_list
|
||||||
|
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ func _enter_tree() -> void:
|
|||||||
style.bg_color = Color("000000d7")
|
style.bg_color = Color("000000d7")
|
||||||
rich_label.selection_enabled = true
|
rich_label.selection_enabled = true
|
||||||
rich_label.context_menu_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.scroll_following = true
|
||||||
rich_label.anchor_right = 1.0
|
rich_label.anchor_right = 1.0
|
||||||
rich_label.anchor_bottom = 0.5
|
rich_label.anchor_bottom = 0.5
|
||||||
@@ -108,7 +108,7 @@ func _enter_tree() -> void:
|
|||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
var console_history_file := FileAccess.open("user://console_history.txt", FileAccess.WRITE)
|
var console_history_file := FileAccess.open("user://console_history.txt", FileAccess.WRITE)
|
||||||
if (console_history_file):
|
if (console_history_file):
|
||||||
var write_index := 0
|
var write_index := 0
|
||||||
var start_write_index := console_history.size() - 100 # Max lines to write
|
var start_write_index := console_history.size() - 100 # Max lines to write
|
||||||
for line in console_history:
|
for line in console_history:
|
||||||
if (write_index >= start_write_index):
|
if (write_index >= start_write_index):
|
||||||
@@ -133,7 +133,8 @@ func _ready() -> void:
|
|||||||
add_command("unpause", unpause, 0, 0, "Unpauses node processing.")
|
add_command("unpause", unpause, 0, 0, "Unpauses node processing.")
|
||||||
add_command("exec", exec, 1, 1, "Execute a script.")
|
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 is InputEventKey):
|
||||||
if (event.get_physical_keycode_with_modifiers() == KEY_QUOTELEFT): # ~ key.
|
if (event.get_physical_keycode_with_modifiers() == KEY_QUOTELEFT): # ~ key.
|
||||||
if (event.pressed):
|
if (event.pressed):
|
||||||
@@ -173,22 +174,23 @@ func _input(event : InputEvent) -> void:
|
|||||||
reset_autocomplete()
|
reset_autocomplete()
|
||||||
if (event.get_physical_keycode_with_modifiers() == KEY_PAGEUP):
|
if (event.get_physical_keycode_with_modifiers() == KEY_PAGEUP):
|
||||||
var scroll := rich_label.get_v_scroll_bar()
|
var scroll := rich_label.get_v_scroll_bar()
|
||||||
var tween := create_tween()
|
var tween := create_tween()
|
||||||
tween.tween_property(scroll, "value", scroll.value - (scroll.page - scroll.page * 0.1), 0.1)
|
tween.tween_property(scroll, "value", scroll.value - (scroll.page - scroll.page * 0.1), 0.1)
|
||||||
get_tree().get_root().set_input_as_handled()
|
get_tree().get_root().set_input_as_handled()
|
||||||
if (event.get_physical_keycode_with_modifiers() == KEY_PAGEDOWN):
|
if (event.get_physical_keycode_with_modifiers() == KEY_PAGEDOWN):
|
||||||
var scroll := rich_label.get_v_scroll_bar()
|
var scroll := rich_label.get_v_scroll_bar()
|
||||||
var tween := create_tween()
|
var tween := create_tween()
|
||||||
tween.tween_property(scroll, "value", scroll.value + (scroll.page - scroll.page * 0.1), 0.1)
|
tween.tween_property(scroll, "value", scroll.value + (scroll.page - scroll.page * 0.1), 0.1)
|
||||||
get_tree().get_root().set_input_as_handled()
|
get_tree().get_root().set_input_as_handled()
|
||||||
if (event.get_physical_keycode_with_modifiers() == KEY_TAB):
|
if (event.get_physical_keycode_with_modifiers() == KEY_TAB):
|
||||||
autocomplete()
|
autocomplete()
|
||||||
get_tree().get_root().set_input_as_handled()
|
get_tree().get_root().set_input_as_handled()
|
||||||
|
|
||||||
|
|
||||||
var suggestions := []
|
var suggestions := []
|
||||||
var current_suggest := 0
|
var current_suggest := 0
|
||||||
var suggesting := false
|
var suggesting := false
|
||||||
|
|
||||||
|
|
||||||
func autocomplete() -> void:
|
func autocomplete() -> void:
|
||||||
if (suggesting):
|
if (suggesting):
|
||||||
@@ -203,11 +205,11 @@ func autocomplete() -> void:
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
suggesting = true
|
suggesting = true
|
||||||
|
|
||||||
if (" " in line_edit.text): # We're searching for a parameter to autocomplete
|
if (" " in line_edit.text): # We're searching for a parameter to autocomplete
|
||||||
var split_text := parse_line_input(line_edit.text)
|
var split_text := parse_line_input(line_edit.text)
|
||||||
if (split_text.size() > 1):
|
if (split_text.size() > 1):
|
||||||
var command := split_text[0]
|
var command := split_text[0]
|
||||||
var param_input := split_text[1]
|
var param_input := split_text[1]
|
||||||
if (command_parameters.has(command)):
|
if (command_parameters.has(command)):
|
||||||
for param in command_parameters[command]:
|
for param in command_parameters[command]:
|
||||||
@@ -220,11 +222,11 @@ func autocomplete() -> void:
|
|||||||
sorted_commands.append(str(command))
|
sorted_commands.append(str(command))
|
||||||
sorted_commands.sort()
|
sorted_commands.sort()
|
||||||
sorted_commands.reverse()
|
sorted_commands.reverse()
|
||||||
|
|
||||||
var prev_index := 0
|
var prev_index := 0
|
||||||
for command in sorted_commands:
|
for command in sorted_commands:
|
||||||
if (!line_edit.text || command.contains(line_edit.text)):
|
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):
|
if (index <= prev_index):
|
||||||
suggestions.push_front(command)
|
suggestions.push_front(command)
|
||||||
else:
|
else:
|
||||||
@@ -284,23 +286,25 @@ func scroll_to_bottom() -> void:
|
|||||||
scroll.value = scroll.max_value - scroll.page
|
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:
|
if not text is String:
|
||||||
text = str(text)
|
text = str(text)
|
||||||
print_line("[color=light_coral] ERROR:[/color] %s" % text, print_godot)
|
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:
|
if not text is String:
|
||||||
text = str(text)
|
text = str(text)
|
||||||
print_line("[color=light_blue] INFO:[/color] %s" % text, print_godot)
|
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:
|
if not text is String:
|
||||||
text = str(text)
|
text = str(text)
|
||||||
print_line("[color=gold] WARNING:[/color] %s" % text, print_godot)
|
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:
|
if not text is String:
|
||||||
text = str(text)
|
text = str(text)
|
||||||
if (!rich_label): # Tried to print something before the console was loaded.
|
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)
|
print(text)
|
||||||
|
|
||||||
|
|
||||||
func parse_line_input(text : String) -> PackedStringArray:
|
func parse_line_input(text: String) -> PackedStringArray:
|
||||||
var out_array : PackedStringArray
|
var out_array: PackedStringArray
|
||||||
var first_char := true
|
var first_char := true
|
||||||
var in_quotes := false
|
var in_quotes := false
|
||||||
var escaped := false
|
var escaped := false
|
||||||
var token : String
|
var token: String
|
||||||
for c in text:
|
for c in text:
|
||||||
if (c == '\\'):
|
if (c == '\\'):
|
||||||
escaped = true
|
escaped = true
|
||||||
@@ -349,23 +353,23 @@ func parse_line_input(text : String) -> PackedStringArray:
|
|||||||
return out_array
|
return out_array
|
||||||
|
|
||||||
|
|
||||||
func on_text_entered(new_text : String) -> void:
|
func on_text_entered(new_text: String) -> void:
|
||||||
scroll_to_bottom()
|
scroll_to_bottom()
|
||||||
reset_autocomplete()
|
reset_autocomplete()
|
||||||
line_edit.clear()
|
line_edit.clear()
|
||||||
if (line_edit.has_method(&"edit")):
|
if (line_edit.has_method(&"edit")):
|
||||||
line_edit.call_deferred(&"edit")
|
line_edit.call_deferred(&"edit")
|
||||||
|
|
||||||
if not new_text.strip_edges().is_empty():
|
if not new_text.strip_edges().is_empty():
|
||||||
add_input_history(new_text)
|
add_input_history(new_text)
|
||||||
print_line("[i]> " + new_text + "[/i]")
|
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]
|
var text_command := text_split[0]
|
||||||
|
|
||||||
if console_commands.has(text_command):
|
if console_commands.has(text_command):
|
||||||
var arguments := text_split.slice(1)
|
var arguments := text_split.slice(1)
|
||||||
var console_command : ConsoleCommand = console_commands[text_command]
|
var console_command: ConsoleCommand = console_commands[text_command]
|
||||||
|
|
||||||
# calc is a especial command that needs special treatment
|
# calc is a especial command that needs special treatment
|
||||||
if (text_command.match("calc")):
|
if (text_command.match("calc")):
|
||||||
var expression := ""
|
var expression := ""
|
||||||
@@ -390,7 +394,7 @@ func on_text_entered(new_text : String) -> void:
|
|||||||
print_error("Command not found.")
|
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()
|
reset_autocomplete()
|
||||||
|
|
||||||
|
|
||||||
@@ -409,30 +413,51 @@ func delete_history() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func help() -> 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]calc[/color]: Calculates a given expresion
|
||||||
[color=light_green]clear[/color]: Clears the registry view
|
[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[/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]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]delete_history[/color]: Deletes the commands history
|
||||||
[color=light_green]echo[/color]: Prints a given string to the console
|
[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_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_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]echo_warning[/color]: Prints a given string as warning to the console
|
||||||
[color=light_green]pause[/color]: Pauses node processing
|
[color=light_green]pause[/color]: Pauses node processing
|
||||||
[color=light_green]unpause[/color]: Unpauses node processing
|
[color=light_green]unpause[/color]: Unpauses node processing
|
||||||
[color=light_green]quit[/color]: Quits the game
|
[color=light_green]quit[/color]: Quits the game
|
||||||
Controls:
|
Controls:
|
||||||
[color=light_blue]Up[/color] and [color=light_blue]Down[/color] arrow keys to navigate commands history
|
[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]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]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]~[/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_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 expression := Expression.new()
|
||||||
var error = expression.parse(command)
|
var error = expression.parse(command)
|
||||||
if error:
|
if error:
|
||||||
print_error("%s" % expression.get_error_text())
|
print_error("%s" % expression.get_error_text())
|
||||||
return
|
return
|
||||||
@@ -459,10 +484,10 @@ func commands_list() -> void:
|
|||||||
if (!console_commands[command].hidden):
|
if (!console_commands[command].hidden):
|
||||||
commands.append(str(command))
|
commands.append(str(command))
|
||||||
commands.sort()
|
commands.sort()
|
||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
var arguments_string := ""
|
var arguments_string := ""
|
||||||
var description : String = console_commands[command].description
|
var description: String = console_commands[command].description
|
||||||
for i in range(console_commands[command].arguments.size()):
|
for i in range(console_commands[command].arguments.size()):
|
||||||
if i < console_commands[command].required:
|
if i < console_commands[command].required:
|
||||||
arguments_string += " [color=cornflower_blue]<" + console_commands[command].arguments[i] + ">[/color]"
|
arguments_string += " [color=cornflower_blue]<" + console_commands[command].arguments[i] + ">[/color]"
|
||||||
@@ -472,13 +497,13 @@ func commands_list() -> void:
|
|||||||
rich_label.append_text("\n")
|
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
|
if (!console_history.size() || text != console_history.back()): # Don't add consecutive duplicates
|
||||||
console_history.append(text)
|
console_history.append(text)
|
||||||
console_history_index = console_history.size()
|
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
|
enable_on_release_build = enable
|
||||||
if (!enable_on_release_build):
|
if (!enable_on_release_build):
|
||||||
if (!OS.is_debug_build()):
|
if (!OS.is_debug_build()):
|
||||||
@@ -487,12 +512,14 @@ func set_enable_on_release_build(enable : bool):
|
|||||||
|
|
||||||
func pause() -> void:
|
func pause() -> void:
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
|
|
||||||
|
|
||||||
func unpause() -> void:
|
func unpause() -> void:
|
||||||
get_tree().paused = false
|
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)
|
var script := FileAccess.open(path, FileAccess.READ)
|
||||||
if (script):
|
if (script):
|
||||||
while (!script.eof_reached()):
|
while (!script.eof_reached()):
|
||||||
|
13
autoloads/config_file_handler.gd
Normal file
13
autoloads/config_file_handler.gd
Normal 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)
|
1
autoloads/config_file_handler.gd.uid
Normal file
1
autoloads/config_file_handler.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dueoywjgtwv7m
|
@@ -77,7 +77,7 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="builds/index.html"
|
export_path="builds/web/index.html"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
|
6
objects/achievements.tscn
Normal file
6
objects/achievements.tscn
Normal 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")
|
@@ -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://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://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="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://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://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"]
|
[ext_resource type="Script" uid="uid://dqmbvuutd5c3c" path="res://scripts/components/flashing_component.gd" id="13_hrtyn"]
|
@@ -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="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://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="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://dx80ivlvuuew4" path="res://objects/fxs/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://ck6nml06tm6ue" path="res://objects/fxs/ice_fx.tscn" id="16_68hnm"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pwwji"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pwwji"]
|
||||||
size = Vector2(25, 31)
|
size = Vector2(25, 31)
|
@@ -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://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://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="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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"]
|
||||||
size = Vector2(16, 10)
|
size = Vector2(16, 10)
|
@@ -1,8 +1,8 @@
|
|||||||
[gd_scene load_steps=7 format=4 uid="uid://dnufqkeiyi5ya"]
|
[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="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://54w4wisfj8v8" path="res://objects/entities/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://ct8fim6mduyl3" path="res://objects/entities/collapsing_bridge.tscn" id="3_ukc1k"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_8idcv"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_8idcv"]
|
||||||
texture = ExtResource("1_51i2x")
|
texture = ExtResource("1_51i2x")
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://coayig4dxelo2"]
|
[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="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"]
|
[node name="BrickThrowComponent" type="Node"]
|
||||||
script = ExtResource("1_hniwk")
|
script = ExtResource("1_hniwk")
|
||||||
|
50
objects/ui/input_button.tscn
Normal file
50
objects/ui/input_button.tscn
Normal 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
|
76
objects/ui/input_settings.tscn
Normal file
76
objects/ui/input_settings.tscn
Normal 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
|
@@ -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://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://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="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"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ode10"]
|
||||||
bg_color = Color(0, 0, 0, 1)
|
bg_color = Color(0, 0, 0, 1)
|
72
objects/ui/settings_menu.tscn
Normal file
72
objects/ui/settings_menu.tscn
Normal 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
|
@@ -22,7 +22,7 @@ run/max_fps=144
|
|||||||
boot_splash/show_image=false
|
boot_splash/show_image=false
|
||||||
boot_splash/fullsize=false
|
boot_splash/fullsize=false
|
||||||
boot_splash/use_filter=false
|
boot_splash/use_filter=false
|
||||||
config/icon="res://icon.svg"
|
config/icon="uid://jix7wdn0isr3"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
@@ -32,6 +32,8 @@ AudioController="*res://objects/audio_controller.tscn"
|
|||||||
SteamIntegrationNode="*res://objects/steam_integration.tscn"
|
SteamIntegrationNode="*res://objects/steam_integration.tscn"
|
||||||
SteamControllerInput="*res://autoloads/steam_controller_input.gd"
|
SteamControllerInput="*res://autoloads/steam_controller_input.gd"
|
||||||
Console="*res://addons/console/console.gd"
|
Console="*res://addons/console/console.gd"
|
||||||
|
AchievementsManager="*res://objects/achievements.tscn"
|
||||||
|
ConfigFileHandler="*res://autoloads/config_file_handler.gd"
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|
||||||
@@ -39,10 +41,11 @@ file_logging/enable_file_logging=true
|
|||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=640
|
window/size/viewport_width=480
|
||||||
window/size/viewport_height=360
|
window/size/viewport_height=270
|
||||||
window/size/window_width_override=1280
|
window/size/initial_position=Vector2i(400, 100)
|
||||||
window/size/window_height_override=720
|
window/size/window_width_override=1440
|
||||||
|
window/size/window_height_override=810
|
||||||
window/stretch/mode="viewport"
|
window/stretch/mode="viewport"
|
||||||
window/stretch/aspect="keep_height"
|
window/stretch/aspect="keep_height"
|
||||||
window/stretch/scale_mode="integer"
|
window/stretch/scale_mode="integer"
|
||||||
@@ -68,6 +71,7 @@ player=""
|
|||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
|
|
||||||
|
theme/default_theme_scale=0.5
|
||||||
theme/custom_font="res://fonts/PressStart2P-Regular.ttf"
|
theme/custom_font="res://fonts/PressStart2P-Regular.ttf"
|
||||||
theme/default_font_antialiasing=0
|
theme/default_font_antialiasing=0
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=4 format=3 uid="uid://cdp8sex36vdq2"]
|
[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="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"]
|
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="3_cgsq1"]
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=4 format=3 uid="uid://2glvryih82t1"]
|
[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="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"]
|
[ext_resource type="PackedScene" uid="uid://coayig4dxelo2" path="res://objects/player_skills/brick_throw_skill.tscn" id="1_g53fp"]
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=4 format=3 uid="uid://cx5fsbexblp60"]
|
[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="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"]
|
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="2_pspkt"]
|
||||||
|
|
||||||
|
@@ -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="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="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://byxf45ukq82pe" path="res://objects/ui/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://dyp4i4ru2j2jh" path="res://objects/fxs/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://dx80ivlvuuew4" path="res://objects/fxs/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://54w4wisfj8v8" path="res://objects/entities/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://bqi5s710xb1ju" path="res://objects/entities/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://bargnp4twtmxg" path="res://objects/entities/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://ct8fim6mduyl3" path="res://objects/entities/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://d08dfqmirnd66" path="res://objects/entities/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://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="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://bwdlmualj6xbw" path="res://objects/entities/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://cm3rixnnev1pg" path="res://objects/entities/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://to2xnqev0pu1" path="res://objects/entities/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://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://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="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://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="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://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://bqom4cm7r18db" path="res://objects/entities/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://dlm2ri562fynd" path="res://objects/ui/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://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://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"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_cagp7"]
|
||||||
texture = ExtResource("1_5lb42")
|
texture = ExtResource("1_5lb42")
|
||||||
@@ -583,6 +586,9 @@ components_to_disable = [NodePath("../../Brick Player")]
|
|||||||
|
|
||||||
[node name="Pause menu" parent="CanvasLayer" instance=ExtResource("25_j7bvy")]
|
[node name="Pause menu" parent="CanvasLayer" instance=ExtResource("25_j7bvy")]
|
||||||
visible = false
|
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")]
|
[node name="Killzone" parent="." instance=ExtResource("20_8a4vc")]
|
||||||
position = Vector2(0, 990)
|
position = Vector2(0, 990)
|
||||||
@@ -595,4 +601,10 @@ text = "Press 'down' to fall from platform!"
|
|||||||
position = Vector2(1576, -40)
|
position = Vector2(1576, -40)
|
||||||
text = "Be careful!"
|
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"]
|
[editable path="Brick Player"]
|
||||||
|
17
scripts/achievements.gd
Normal file
17
scripts/achievements.gd
Normal 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
|
1
scripts/achievements.gd.uid
Normal file
1
scripts/achievements.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://deguukal87gcb
|
@@ -1,7 +1,7 @@
|
|||||||
class_name PeriodicShootingComponent
|
class_name PeriodicShootingComponent
|
||||||
extends Node
|
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_interval: float = 1.0
|
||||||
@export var shoot_direction: Vector2 = Vector2.RIGHT
|
@export var shoot_direction: Vector2 = Vector2.RIGHT
|
||||||
@export var side_to_side_movement: SideToSideMovement
|
@export var side_to_side_movement: SideToSideMovement
|
||||||
@@ -45,4 +45,4 @@ func setup_timer() -> void:
|
|||||||
timer.one_shot = false
|
timer.one_shot = false
|
||||||
timer.autostart = true
|
timer.autostart = true
|
||||||
timer.timeout.connect(on_timer_timeout)
|
timer.timeout.connect(on_timer_timeout)
|
||||||
add_child(timer)
|
add_child(timer)
|
||||||
|
@@ -22,14 +22,17 @@ func try_unlock_skill(skill_data: SkillData) -> bool:
|
|||||||
return true
|
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:
|
func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("unlock_skills"):
|
if event.is_action_pressed("unlock_skills"):
|
||||||
var available_skills: Array[SkillData] = skill_manager.available_skills
|
unlock_all_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)
|
|
134
scripts/console_management.gd
Normal file
134
scripts/console_management.gd
Normal 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))
|
1
scripts/console_management.gd.uid
Normal file
1
scripts/console_management.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://8r1y8elyw7kt
|
@@ -103,6 +103,11 @@ func unlock_skill(skill_name: String) -> void:
|
|||||||
player_state["unlocked_skills"].append(skill_name)
|
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:
|
func unlock_skills(skill_names: Array[String]) -> void:
|
||||||
for skill_name in skill_names:
|
for skill_name in skill_names:
|
||||||
unlock_skill(skill_name)
|
unlock_skill(skill_name)
|
||||||
|
99
scripts/input_settings.gd
Normal file
99
scripts/input_settings.gd
Normal 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
|
1
scripts/input_settings.gd.uid
Normal file
1
scripts/input_settings.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dppwl7xie2mh
|
@@ -13,6 +13,7 @@ extends Node
|
|||||||
|
|
||||||
var is_paused: bool = false
|
var is_paused: bool = false
|
||||||
var is_console_open: bool = false
|
var is_console_open: bool = false
|
||||||
|
var settings_menu_instance: Control
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -42,6 +43,8 @@ func _ready() -> void:
|
|||||||
quit_button.pressed.connect(_on_quit_button_pressed)
|
quit_button.pressed.connect(_on_quit_button_pressed)
|
||||||
settings_button.pressed.connect(_on_settings_button_pressed)
|
settings_button.pressed.connect(_on_settings_button_pressed)
|
||||||
exit_to_menu_button.pressed.connect(_on_exit_to_menu_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:
|
func _input(event: InputEvent) -> void:
|
||||||
@@ -57,6 +60,9 @@ func _input(event: InputEvent) -> void:
|
|||||||
|
|
||||||
func _on_resume_button_pressed() -> void:
|
func _on_resume_button_pressed() -> void:
|
||||||
pause_menu_control.hide()
|
pause_menu_control.hide()
|
||||||
|
if settings_menu_instance:
|
||||||
|
settings_menu_instance.queue_free()
|
||||||
|
settings_menu_instance = null
|
||||||
gm.resume_game()
|
gm.resume_game()
|
||||||
is_paused = false
|
is_paused = false
|
||||||
|
|
||||||
@@ -71,9 +77,9 @@ func _on_settings_button_pressed() -> void:
|
|||||||
return
|
return
|
||||||
|
|
||||||
var settings_instance: Control = settings_menu.instantiate()
|
var settings_instance: Control = settings_menu.instantiate()
|
||||||
get_tree().root.add_child(settings_instance)
|
add_child(settings_instance)
|
||||||
settings_instance.show()
|
settings_instance.show()
|
||||||
pause_menu_control.hide()
|
settings_menu_instance = settings_instance
|
||||||
gm.pause_game()
|
gm.pause_game()
|
||||||
is_paused = true
|
is_paused = true
|
||||||
|
|
||||||
@@ -87,8 +93,8 @@ func _on_exit_to_menu_button_pressed() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_console_open():
|
func _on_console_open():
|
||||||
pass
|
is_console_open = true
|
||||||
|
|
||||||
|
|
||||||
func _on_console_close():
|
func _on_console_close():
|
||||||
pass
|
is_console_open = false
|
||||||
|
8
scripts/settings_menu.gd
Normal file
8
scripts/settings_menu.gd
Normal 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
|
1
scripts/settings_menu.gd.uid
Normal file
1
scripts/settings_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://c506rigcjlm6x
|
@@ -55,3 +55,10 @@ func apply_unlocked_skills() -> void:
|
|||||||
add_skill(skill_data)
|
add_skill(skill_data)
|
||||||
else:
|
else:
|
||||||
remove_skill(skill_data.name)
|
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
BIN
sprites/ppc_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 464 B |
34
sprites/ppc_icon.png.import
Normal file
34
sprites/ppc_icon.png.import
Normal 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
|
Reference in New Issue
Block a user