Compare commits

...

22 Commits

Author SHA1 Message Date
cbf625d2ff fix: update scene files for unique IDs and adjust JumpForce in JumpPadComponent 2026-03-19 11:32:48 +01:00
057cf7b368 feat: add UID files for InputDeviceManager, SettingsManager, DisplaySettings, GameplaySettings, and InputSettings 2026-03-19 03:53:49 +01:00
829d081eab fix: unsubscribe VisibilityChanged in _ExitTree, use IsActionReleased for ui_cancel, expose ApplyGamepadDeadzone public 2026-03-19 03:51:01 +01:00
38c86f1a67 feat: gameplay settings screen (deadzone + sensitivity) 2026-03-19 03:47:15 +01:00
e647cd7b29 feat: marketplace keyboard/gamepad navigation 2026-03-19 03:44:35 +01:00
9043cfa63c fix: InputSettings PhysicalKeycode, visibility guard, dead code, delegate save 2026-03-19 03:42:47 +01:00
dc46769c11 feat: input remapping screen with conflict detection and config persistence 2026-03-19 03:39:19 +01:00
47600be867 fix: route resolution change through SettingsManager.ApplyDisplaySettings 2026-03-19 03:36:29 +01:00
3e74959bb9 fix: DisplaySettings focus mode, remove duplicate ApplyWindowMode 2026-03-19 03:35:28 +01:00
8cce1866b1 feat: display settings screen with window mode and resolution picker 2026-03-19 03:32:40 +01:00
0105698c33 fix: guard GrabFirstFocus on pointerless, unsub VisibilityChanged in _ExitTree 2026-03-19 03:29:36 +01:00
3b18e328b2 feat: gamepad/keyboard UI navigation on all menus 2026-03-19 03:26:50 +01:00
2bc0b76050 fix: joypad drift threshold + move InputDevice enum inside class 2026-03-19 03:24:19 +01:00
d83e3b4d82 feat: add InputDeviceManager autoload for input device tracking 2026-03-19 03:22:17 +01:00
42d7df27ae fix: SettingsManager null guard, ui_ filter, double cast for sensitivity/deadzone 2026-03-19 03:21:04 +01:00
fd54e16bf4 fix: make GamepadDeadzone/Sensitivity/WindowMode/Resolution setters public 2026-03-19 03:18:46 +01:00
92a3c4f79a feat: add SettingsManager autoload for display, gamepad and input binding settings 2026-03-19 03:17:26 +01:00
654a8b7ea7 fix: add .worktrees/ to gitignore 2026-03-19 03:15:09 +01:00
53ebbbbac3 feat: add movement presets for platform and spaceship, update abilities in scenes 2026-03-19 02:55:03 +01:00
551dc09485 feat: add unique identifier for MovementPreset 2026-03-19 02:46:55 +01:00
814d9736d0 refactor: movement system - MovementPreset, decouple abilities, fix timing 2026-03-19 02:45:26 +01:00
adaeb35fdd chore: ignore .worktrees dir 2026-03-19 02:43:41 +01:00
48 changed files with 1245 additions and 249 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
# Godot 4+ specific ignores # Godot 4+ specific ignores
.godot/ .godot/
/android/ /android/
builds/ builds/
.worktrees/

View File

@@ -0,0 +1,54 @@
using Godot;
namespace Mr.BrickAdventures.Autoloads;
public partial class InputDeviceManager : Node
{
public enum InputDevice { Mouse, Keyboard, Gamepad }
public static InputDeviceManager Instance { get; private set; }
public InputDevice CurrentDevice { get; private set; } = InputDevice.Mouse;
public bool IsPointerless => CurrentDevice is InputDevice.Keyboard or InputDevice.Gamepad;
[Signal] public delegate void DeviceChangedEventHandler(int device);
public override void _Ready()
{
Instance = this;
Input.MouseMode = Input.MouseModeEnum.Visible;
}
public override void _ExitTree()
{
if (Instance == this) Instance = null;
}
public override void _Input(InputEvent @event)
{
InputDevice detected;
if (@event is InputEventMouseMotion or InputEventMouseButton)
detected = InputDevice.Mouse;
else if (@event is InputEventKey)
detected = InputDevice.Keyboard;
else if (@event is InputEventJoypadButton)
detected = InputDevice.Gamepad;
else if (@event is InputEventJoypadMotion joyEvent)
{
if (Mathf.Abs(joyEvent.AxisValue) <= 0.15f) return;
detected = InputDevice.Gamepad;
}
else
return;
if (detected == CurrentDevice) return;
CurrentDevice = detected;
Input.MouseMode = CurrentDevice == InputDevice.Mouse
? Input.MouseModeEnum.Visible
: Input.MouseModeEnum.Hidden;
EmitSignal(SignalName.DeviceChanged, (int)CurrentDevice);
}
}

View File

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

View File

@@ -0,0 +1,203 @@
using Godot;
using System.Collections.Generic;
namespace Mr.BrickAdventures.Autoloads;
public partial class SettingsManager : Node
{
public static SettingsManager Instance { get; private set; }
public float GamepadDeadzone { get; set; } = 0.2f;
public float GamepadSensitivity { get; set; } = 1.0f;
public string WindowMode { get; set; } = "fullscreen";
public Vector2I Resolution { get; set; } = new Vector2I(1920, 1080);
private static readonly List<Vector2I> CuratedResolutions = new()
{
// 4:3
new Vector2I(640, 480),
new Vector2I(800, 600),
new Vector2I(1024, 768),
new Vector2I(1280, 960),
new Vector2I(1600, 1200),
// 16:9
new Vector2I(1280, 720),
new Vector2I(1366, 768),
new Vector2I(1600, 900),
new Vector2I(1920, 1080),
new Vector2I(2560, 1440),
new Vector2I(3840, 2160),
// 16:10
new Vector2I(1280, 800),
new Vector2I(1440, 900),
new Vector2I(1920, 1200),
new Vector2I(2560, 1600),
};
private readonly List<Vector2I> _customResolutions = new();
private static readonly string[] DeadzoneActions = { "left", "right", "up", "down" };
public override void _Ready()
{
Instance = this;
if (ConfigFileHandler.Instance == null)
{
GD.PushError("SettingsManager: ConfigFileHandler.Instance is null");
return;
}
var cfg = ConfigFileHandler.Instance.SettingsConfig;
// --- display_settings ---
WindowMode = cfg.GetValue("display_settings", "window_mode", Variant.From("fullscreen")).AsString();
var resStr = cfg.GetValue("display_settings", "resolution", Variant.From("1920x1080")).AsString();
Resolution = ParseResolution(resStr, new Vector2I(1920, 1080));
var customResStr = cfg.GetValue("display_settings", "custom_resolutions", Variant.From("")).AsString();
if (!string.IsNullOrWhiteSpace(customResStr))
{
foreach (var part in customResStr.Split(','))
{
var r = ParseResolution(part.Trim(), Vector2I.Zero);
if (r != Vector2I.Zero)
_customResolutions.Add(r);
}
}
ApplyDisplaySettings();
// --- gameplay_settings ---
GamepadDeadzone = (float)cfg.GetValue("gameplay_settings", "gamepad_deadzone", Variant.From(0.2)).AsDouble();
GamepadSensitivity = (float)cfg.GetValue("gameplay_settings", "gamepad_sensitivity", Variant.From(1.0)).AsDouble();
ApplyGamepadDeadzone();
// --- input_settings ---
ApplyInputBindings(cfg);
}
public override void _ExitTree()
{
if (Instance == this) Instance = null;
}
// ── public API ───────────────────────────────────────────────────────────
public List<Vector2I> GetAllResolutions()
{
var all = new List<Vector2I>(CuratedResolutions);
all.AddRange(_customResolutions);
return all;
}
public void SaveDisplaySettings()
{
var cfg = ConfigFileHandler.Instance.SettingsConfig;
cfg.SetValue("display_settings", "window_mode", WindowMode);
cfg.SetValue("display_settings", "resolution", $"{Resolution.X}x{Resolution.Y}");
cfg.SetValue("display_settings", "custom_resolutions", BuildCustomResolutionsString());
cfg.Save(ConfigFileHandler.SettingsPath);
}
public void SaveGameplaySettings()
{
var cfg = ConfigFileHandler.Instance.SettingsConfig;
cfg.SetValue("gameplay_settings", "gamepad_deadzone", (double)GamepadDeadzone);
cfg.SetValue("gameplay_settings", "gamepad_sensitivity", (double)GamepadSensitivity);
cfg.Save(ConfigFileHandler.SettingsPath);
}
public void SaveInputSettings()
{
var cfg = ConfigFileHandler.Instance.SettingsConfig;
foreach (var action in InputMap.GetActions())
{
if (action.ToString().StartsWith("ui_")) continue;
foreach (var ev in InputMap.ActionGetEvents(action))
{
if (ev is InputEventKey key)
{
cfg.SetValue("input_settings", action, (long)key.PhysicalKeycode);
break;
}
}
}
cfg.Save(ConfigFileHandler.SettingsPath);
}
// ── apply helpers ────────────────────────────────────────────────────────
public void ApplyDisplaySettings()
{
switch (WindowMode)
{
case "fullscreen":
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
break;
case "borderless":
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
DisplayServer.WindowSetFlag(DisplayServer.WindowFlags.Borderless, true);
DisplayServer.WindowSetSize(Resolution);
break;
default: // "windowed"
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
DisplayServer.WindowSetFlag(DisplayServer.WindowFlags.Borderless, false);
DisplayServer.WindowSetSize(Resolution);
break;
}
}
public void ApplyGamepadDeadzone()
{
foreach (var action in DeadzoneActions)
{
if (InputMap.HasAction(action))
InputMap.ActionSetDeadzone(action, GamepadDeadzone);
}
}
private static void ApplyInputBindings(ConfigFile cfg)
{
if (!cfg.HasSection("input_settings")) return;
foreach (var actionName in cfg.GetSectionKeys("input_settings"))
{
if (actionName.StartsWith("ui_")) continue;
if (!InputMap.HasAction(actionName)) continue;
var scancode = (Key)(long)cfg.GetValue("input_settings", actionName);
// Remove existing keyboard events for this action
var events = InputMap.ActionGetEvents(actionName);
foreach (var ev in events)
{
if (ev is InputEventKey)
InputMap.ActionEraseEvent(actionName, ev);
}
// Add the saved key
var newKey = new InputEventKey { PhysicalKeycode = scancode };
InputMap.ActionAddEvent(actionName, newKey);
}
}
// ── util ─────────────────────────────────────────────────────────────────
private static Vector2I ParseResolution(string s, Vector2I fallback)
{
var parts = s.Split('x');
if (parts.Length == 2 && int.TryParse(parts[0], out var w) && int.TryParse(parts[1], out var h))
return new Vector2I(w, h);
return fallback;
}
private string BuildCustomResolutionsString()
{
var parts = new List<string>();
foreach (var r in _customResolutions)
parts.Add($"{r.X}x{r.Y}");
return string.Join(",", parts);
}
}

View File

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

View File

@@ -1,22 +1,12 @@
[gd_scene load_steps=57 format=3 uid="uid://bqi5s710xb1ju"] [gd_scene format=3 uid="uid://bqi5s710xb1ju"]
[ext_resource type="Script" uid="uid://csel4s0e4g5uf" path="res://scripts/components/PlayerController.cs" id="1_yysbb"] [ext_resource type="Script" uid="uid://csel4s0e4g5uf" path="res://scripts/components/PlayerController.cs" id="1_yysbb"]
[ext_resource type="Resource" uid="uid://vgutbpovj8hc" path="res://resources/movement_presets/platform_movement.tres" id="2_7til7"]
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"] [ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
[ext_resource type="PackedScene" uid="uid://bcv8kx6bc7u5e" path="res://objects/movement_abilities/ground_ability.tscn" id="2_oefns"]
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"] [ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"]
[ext_resource type="PackedScene" uid="uid://d0r5edxnx5jqx" path="res://objects/movement_abilities/variable_jump_ability.tscn" id="3_bnap0"]
[ext_resource type="Script" uid="uid://bf4yclropol43" path="res://scripts/components/Movement/GroundMovementAbility.cs" id="4_7til7"]
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"] [ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"]
[ext_resource type="PackedScene" uid="uid://cala7bpo1v4no" path="res://objects/movement_abilities/gravity_ability.tscn" id="4_qec3q"]
[ext_resource type="PackedScene" uid="uid://bty3jq8u0pxkf" path="res://objects/movement_abilities/one_way_platform_ability.tscn" id="5_dhjci"]
[ext_resource type="Texture2D" uid="uid://0l454rfplmqg" path="res://sprites/MrBrick_base-sheet.png" id="5_yysbb"] [ext_resource type="Texture2D" uid="uid://0l454rfplmqg" path="res://sprites/MrBrick_base-sheet.png" id="5_yysbb"]
[ext_resource type="PackedScene" uid="uid://bu3vuxlrvoo1t" path="res://objects/movement_abilities/spaceship_ability.tscn" id="6_721q0"]
[ext_resource type="Script" uid="uid://chgw53qwt7rt8" path="res://scripts/components/Movement/GravityAbility.cs" id="6_xuhvf"]
[ext_resource type="Script" uid="uid://ccksp2e76s7sr" path="res://scripts/components/Movement/VariableJumpAbility.cs" id="7_bl1gx"]
[ext_resource type="PackedScene" uid="uid://chjbi5mgtwhsh" path="res://objects/movement_abilities/wall_jump_ability.tscn" id="7_bnap0"]
[ext_resource type="Script" uid="uid://ck6kmnbwhsttt" path="res://scripts/components/Movement/OneWayPlatformAbility.cs" id="7_uno3u"]
[ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="8_6lsog"] [ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="8_6lsog"]
[ext_resource type="PackedScene" uid="uid://dre1vit1m4d2n" path="res://objects/movement_abilities/grid_movement_ability.tscn" id="8_xuhvf"]
[ext_resource type="Script" uid="uid://dy78ak8eykw6e" path="res://scripts/components/FlipComponent.cs" id="9_yysbb"] [ext_resource type="Script" uid="uid://dy78ak8eykw6e" path="res://scripts/components/FlipComponent.cs" id="9_yysbb"]
[ext_resource type="Script" uid="uid://mnjg3p0aw1ow" path="res://scripts/components/CanPickUpComponent.cs" id="10_yysbb"] [ext_resource type="Script" uid="uid://mnjg3p0aw1ow" path="res://scripts/components/CanPickUpComponent.cs" id="10_yysbb"]
[ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="12_ur2y5"] [ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="12_ur2y5"]
@@ -75,7 +65,7 @@ point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_xoue7"] [sub_resource type="CurveTexture" id="CurveTexture_xoue7"]
curve = SubResource("Curve_82d6e") curve = SubResource("Curve_82d6e")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_lgb3u"] [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_oxudy"]
resource_local_to_scene = true resource_local_to_scene = true
lifetime_randomness = 1.0 lifetime_randomness = 1.0
particle_flag_disable_z = true particle_flag_disable_z = true
@@ -92,227 +82,202 @@ scale_curve = SubResource("CurveTexture_xoue7")
color = Color(0.764706, 0.443137, 0, 1) color = Color(0.764706, 0.443137, 0, 1)
color_ramp = SubResource("GradientTexture1D_lgb3u") color_ramp = SubResource("GradientTexture1D_lgb3u")
[node name="Brick Player" type="CharacterBody2D" node_paths=PackedStringArray("MovementAbilitiesContainer") groups=["player"]] [node name="Brick Player" type="CharacterBody2D" unique_id=634211282 node_paths=PackedStringArray("MovementAbilitiesContainer") groups=["player"]]
collision_layer = 4 collision_layer = 4
collision_mask = 107 collision_mask = 107
script = ExtResource("1_yysbb") script = ExtResource("1_yysbb")
MovementAbilitiesContainer = NodePath("Movements") MovementAbilitiesContainer = NodePath("Movements")
GroundMovementScene = ExtResource("2_oefns") DefaultPreset = ExtResource("2_7til7")
JumpMovementScene = ExtResource("3_bnap0")
GravityScene = ExtResource("4_qec3q")
OneWayPlatformScene = ExtResource("5_dhjci")
SpaceshipMovementScene = ExtResource("6_721q0")
WallJumpScene = ExtResource("7_bnap0")
GridMovementScene = ExtResource("8_xuhvf")
metadata/_custom_type_script = "uid://csel4s0e4g5uf" metadata/_custom_type_script = "uid://csel4s0e4g5uf"
[node name="Movements" type="Node" parent="."] [node name="Movements" type="Node" parent="." unique_id=1545001]
[node name="GroundMovementAbility" type="Node" parent="Movements"] [node name="Graphics" type="Node2D" parent="." unique_id=271317654]
script = ExtResource("4_7til7")
MaxSpeed = 376.0
Friction = 2500.0
metadata/_custom_type_script = "uid://bf4yclropol43"
[node name="GravityAbility" type="Node" parent="Movements"] [node name="Root" type="Node2D" parent="Graphics" unique_id=2012260442]
script = ExtResource("6_xuhvf")
metadata/_custom_type_script = "uid://chgw53qwt7rt8"
[node name="VariableJumpAbility" type="Node" parent="Movements"] [node name="Base" type="Sprite2D" parent="Graphics/Root" unique_id=1178176210]
script = ExtResource("7_bl1gx")
JumpCutMultiplier = 0.507
metadata/_custom_type_script = "uid://ccksp2e76s7sr"
[node name="OneWayPlatformAbility" type="Node" parent="Movements"]
script = ExtResource("7_uno3u")
metadata/_custom_type_script = "uid://ck6kmnbwhsttt"
[node name="Graphics" type="Node2D" parent="."]
[node name="Root" type="Node2D" parent="Graphics"]
[node name="Base" type="Sprite2D" parent="Graphics/Root"]
material = SubResource("ShaderMaterial_xoue7") material = SubResource("ShaderMaterial_xoue7")
texture = ExtResource("5_yysbb") texture = ExtResource("5_yysbb")
hframes = 5 hframes = 5
[node name="Left Eye" type="Sprite2D" parent="Graphics/Root"] [node name="Left Eye" type="Sprite2D" parent="Graphics/Root" unique_id=653633051]
position = Vector2(-7, -6) position = Vector2(-7, -6)
texture = ExtResource("3_2srrh") texture = ExtResource("3_2srrh")
hframes = 2 hframes = 2
[node name="Right Eye" type="Sprite2D" parent="Graphics/Root"] [node name="Right Eye" type="Sprite2D" parent="Graphics/Root" unique_id=721230787]
position = Vector2(6, -5) position = Vector2(6, -5)
texture = ExtResource("4_ccn81") texture = ExtResource("4_ccn81")
hframes = 2 hframes = 2
[node name="Ship" type="Sprite2D" parent="Graphics"] [node name="Ship" type="Sprite2D" parent="Graphics" unique_id=1074443059]
visible = false visible = false
position = Vector2(1, 7) position = Vector2(1, 7)
texture = ExtResource("8_6lsog") texture = ExtResource("8_6lsog")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=22428429]
visible = false visible = false
position = Vector2(0, 0.5) position = Vector2(0, 0.5)
shape = SubResource("RectangleShape2D_hdsg1") shape = SubResource("RectangleShape2D_hdsg1")
[node name="FlipPlayerComponent" type="Node2D" parent="." node_paths=PackedStringArray("LeftEye", "RightEye", "PlayerController")] [node name="FlipPlayerComponent" type="Node2D" parent="." unique_id=290535881 node_paths=PackedStringArray("LeftEye", "RightEye", "PlayerController")]
script = ExtResource("9_yysbb") script = ExtResource("9_yysbb")
LeftEye = NodePath("../Graphics/Root/Left Eye") LeftEye = NodePath("../Graphics/Root/Left Eye")
RightEye = NodePath("../Graphics/Root/Right Eye") RightEye = NodePath("../Graphics/Root/Right Eye")
PlayerController = NodePath("..") PlayerController = NodePath("..")
[node name="StompDamageArea" type="Area2D" parent="."] [node name="StompDamageArea" type="Area2D" parent="." unique_id=2071262827]
collision_layer = 0 collision_layer = 0
collision_mask = 8 collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="StompDamageArea"] [node name="CollisionShape2D" type="CollisionShape2D" parent="StompDamageArea" unique_id=1230518642]
visible = false visible = false
position = Vector2(0, 1) position = Vector2(0, 1)
shape = SubResource("RectangleShape2D_vad0t") shape = SubResource("RectangleShape2D_vad0t")
[node name="CanPickUpComponent" type="Node" parent="."] [node name="CanPickUpComponent" type="Node" parent="." unique_id=1912343790]
script = ExtResource("10_yysbb") script = ExtResource("10_yysbb")
[node name="HealthComponent" type="Node2D" parent="." node_paths=PackedStringArray("HurtSfx", "HealSfx")] [node name="HealthComponent" type="Node2D" parent="." unique_id=278902432 node_paths=PackedStringArray("HurtSfx", "HealSfx")]
script = ExtResource("12_ur2y5") script = ExtResource("12_ur2y5")
HurtSfx = NodePath("../sfx_hurt") HurtSfx = NodePath("../sfx_hurt")
HealSfx = NodePath("../sfx_heal") HealSfx = NodePath("../sfx_heal")
[node name="PlayerDeathComponent" type="Node2D" parent="." node_paths=PackedStringArray("DeathSfx", "HealthComponent")] [node name="PlayerDeathComponent" type="Node2D" parent="." unique_id=1989490803 node_paths=PackedStringArray("DeathSfx", "HealthComponent")]
process_mode = 3 process_mode = 3
script = ExtResource("13_7til7") script = ExtResource("13_7til7")
DeathSfx = NodePath("../sfx_hurt") DeathSfx = NodePath("../sfx_hurt")
HealthComponent = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="InvulnerabilityComponent" type="Node" parent="." node_paths=PackedStringArray("FlashingComponent")] [node name="InvulnerabilityComponent" type="Node" parent="." unique_id=963173254 node_paths=PackedStringArray("FlashingComponent")]
script = ExtResource("15_xuhvf") script = ExtResource("15_xuhvf")
FlashingComponent = NodePath("../FlashingComponent Base") FlashingComponent = NodePath("../FlashingComponent Base")
[node name="FlashingComponent Base" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")] [node name="FlashingComponent Base" type="Node" parent="." unique_id=533766453 node_paths=PackedStringArray("Sprite", "HealthComponent")]
script = ExtResource("16_uno3u") script = ExtResource("16_uno3u")
Sprite = NodePath("../Graphics/Root/Base") Sprite = NodePath("../Graphics/Root/Base")
FlashDuration = 1.0 FlashDuration = 1.0
HealthComponent = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="FlashingComponent LEye" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")] [node name="FlashingComponent LEye" type="Node" parent="." unique_id=835038717 node_paths=PackedStringArray("Sprite", "HealthComponent")]
script = ExtResource("16_uno3u") script = ExtResource("16_uno3u")
Sprite = NodePath("../Graphics/Root/Left Eye") Sprite = NodePath("../Graphics/Root/Left Eye")
FlashDuration = 1.0 FlashDuration = 1.0
HealthComponent = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="FlashingComponent REye" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")] [node name="FlashingComponent REye" type="Node" parent="." unique_id=601265429 node_paths=PackedStringArray("Sprite", "HealthComponent")]
script = ExtResource("16_uno3u") script = ExtResource("16_uno3u")
Sprite = NodePath("../Graphics/Root/Right Eye") Sprite = NodePath("../Graphics/Root/Right Eye")
FlashDuration = 1.0 FlashDuration = 1.0
HealthComponent = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="StompDamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area", "Root")] [node name="StompDamageComponent" type="Node" parent="." unique_id=1027107459 node_paths=PackedStringArray("Area", "Root")]
script = ExtResource("17_bl1gx") script = ExtResource("17_bl1gx")
Damage = 4.0 Damage = 4.0
Area = NodePath("../StompDamageArea") Area = NodePath("../StompDamageArea")
Root = NodePath("..") Root = NodePath("..")
[node name="SkillUnlockerComponent" type="Node" parent="."] [node name="SkillUnlockerComponent" type="Node" parent="." unique_id=496647555]
script = ExtResource("25_yysbb") script = ExtResource("25_yysbb")
[node name="HitComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Health", "HitFx")] [node name="HitComponent" type="Node" parent="." unique_id=131916578 node_paths=PackedStringArray("Sprite", "Health", "HitFx")]
script = ExtResource("26_6n1ss") script = ExtResource("26_6n1ss")
Sprite = NodePath("../Graphics/Root/Base") Sprite = NodePath("../Graphics/Root/Base")
Health = NodePath("../HealthComponent") Health = NodePath("../HealthComponent")
HitFx = NodePath("../HitParticles") HitFx = NodePath("../HitParticles")
[node name="MagneticArea" type="Area2D" parent="."] [node name="MagneticArea" type="Area2D" parent="." unique_id=1477305842]
collision_layer = 0 collision_layer = 0
collision_mask = 2 collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="MagneticArea"] [node name="CollisionShape2D" type="CollisionShape2D" parent="MagneticArea" unique_id=1552683633]
visible = false visible = false
shape = SubResource("CircleShape2D_ps31c") shape = SubResource("CircleShape2D_ps31c")
[node name="CanBeLaunchedComponent" type="Node" parent="."] [node name="CanBeLaunchedComponent" type="Node" parent="." unique_id=1998429478]
script = ExtResource("27_oefns") script = ExtResource("27_oefns")
[node name="TriggerLeverComponent" type="Node" parent="."] [node name="TriggerLeverComponent" type="Node" parent="." unique_id=366225548]
script = ExtResource("28_bnap0") script = ExtResource("28_bnap0")
[node name="sfx_jump" type="AudioStreamPlayer2D" parent="."] [node name="sfx_jump" type="AudioStreamPlayer2D" parent="." unique_id=218072388]
stream = ExtResource("18_pysae") stream = ExtResource("18_pysae")
bus = &"sfx" bus = &"sfx"
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."] [node name="sfx_hurt" type="AudioStreamPlayer2D" parent="." unique_id=1815263121]
stream = ExtResource("19_7anly") stream = ExtResource("19_7anly")
bus = &"sfx" bus = &"sfx"
[node name="sfx_heal" type="AudioStreamPlayer2D" parent="."] [node name="sfx_heal" type="AudioStreamPlayer2D" parent="." unique_id=1792916109]
stream = ExtResource("20_bptj5") stream = ExtResource("20_bptj5")
bus = &"sfx" bus = &"sfx"
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="."] [node name="sfx_shoot" type="AudioStreamPlayer2D" parent="." unique_id=1414786458]
stream = ExtResource("32_x2b7c") stream = ExtResource("32_x2b7c")
bus = &"sfx" bus = &"sfx"
[node name="ChargingBarLayer" parent="." instance=ExtResource("28_3f5nm")] [node name="ChargingBarLayer" parent="." unique_id=664675361 instance=ExtResource("28_3f5nm")]
offset_left = -17.0 offset_left = -17.0
offset_top = -30.0 offset_top = -30.0
offset_right = 23.0 offset_right = 23.0
offset_bottom = -20.0 offset_bottom = -20.0
[node name="HitParticles" parent="." instance=ExtResource("28_jh5m0")] [node name="HitParticles" parent="." unique_id=1322585720 instance=ExtResource("28_jh5m0")]
process_material = SubResource("ParticleProcessMaterial_lgb3u") process_material = SubResource("ParticleProcessMaterial_oxudy")
[node name="ShipShooter" type="Node" parent="." node_paths=PackedStringArray("BulletSpawn", "ShootSfx")] [node name="ShipShooter" type="Node" parent="." unique_id=1147013800 node_paths=PackedStringArray("BulletSpawn", "ShootSfx")]
script = ExtResource("30_usc1p") script = ExtResource("30_usc1p")
BulletScene = ExtResource("36_oxudy") BulletScene = ExtResource("36_oxudy")
BulletSpawn = NodePath("../Ship shoot spawn") BulletSpawn = NodePath("../Ship shoot spawn")
ShootSfx = NodePath("../sfx_shoot") ShootSfx = NodePath("../sfx_shoot")
[node name="Ship shoot spawn" type="Marker2D" parent="."] [node name="Ship shoot spawn" type="Marker2D" parent="." unique_id=1653596970]
position = Vector2(17, 5) position = Vector2(17, 5)
gizmo_extents = 1.0 gizmo_extents = 1.0
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] [node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." unique_id=65174812]
position = Vector2(0, 3) position = Vector2(0, 3)
scale = Vector2(0.8, 1.9) scale = Vector2(0.8, 1.9)
[node name="PlayerInputHandler" type="Node" parent="."] [node name="PlayerInputHandler" type="Node" parent="." unique_id=1581385683]
script = ExtResource("42_e5pae") script = ExtResource("42_e5pae")
metadata/_custom_type_script = "uid://dssa2taiwktis" metadata/_custom_type_script = "uid://dssa2taiwktis"
[node name="SpriteTilterComponent" type="Node" parent="." node_paths=PackedStringArray("RotationTarget")] [node name="SpriteTilterComponent" type="Node" parent="." unique_id=1433925210 node_paths=PackedStringArray("RotationTarget")]
script = ExtResource("43_xuhvf") script = ExtResource("43_xuhvf")
RotationTarget = NodePath("../Graphics/Root/Base") RotationTarget = NodePath("../Graphics/Root/Base")
metadata/_custom_type_script = "uid://ceoxet1nqws8w" metadata/_custom_type_script = "uid://ceoxet1nqws8w"
[node name="PlayerSfxComponent" type="Node" parent="." node_paths=PackedStringArray("JumpSfx")] [node name="PlayerSfxComponent" type="Node" parent="." unique_id=1375936690 node_paths=PackedStringArray("JumpSfx")]
script = ExtResource("49_qec3q") script = ExtResource("49_qec3q")
JumpSfx = NodePath("../sfx_jump") JumpSfx = NodePath("../sfx_jump")
metadata/_custom_type_script = "uid://b1h8r5irryxcx" metadata/_custom_type_script = "uid://b1h8r5irryxcx"
[node name="PlayerGraphicsComponent" type="Node" parent="." node_paths=PackedStringArray("DefaultSprite", "SpaceshipSprite")] [node name="PlayerGraphicsComponent" type="Node" parent="." unique_id=443649347 node_paths=PackedStringArray("DefaultSprite", "SpaceshipSprite")]
script = ExtResource("50_dhjci") script = ExtResource("50_dhjci")
DefaultSprite = NodePath("../Graphics/Root") DefaultSprite = NodePath("../Graphics/Root")
SpaceshipSprite = NodePath("../Graphics/Ship") SpaceshipSprite = NodePath("../Graphics/Ship")
metadata/_custom_type_script = "uid://b2aanqykvdnev" metadata/_custom_type_script = "uid://b2aanqykvdnev"
[node name="ProgressiveDamageComponent" type="Node" parent="." node_paths=PackedStringArray("HealthComponent", "Sprite")] [node name="ProgressiveDamageComponent" type="Node" parent="." unique_id=1763641730 node_paths=PackedStringArray("HealthComponent", "Sprite")]
script = ExtResource("38_dhjci") script = ExtResource("38_dhjci")
HealthComponent = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
Sprite = NodePath("../Graphics/Root/Base") Sprite = NodePath("../Graphics/Root/Base")
metadata/_custom_type_script = "uid://dupnaark1f7gm" metadata/_custom_type_script = "uid://dupnaark1f7gm"
[node name="PacXonGridInteractor" type="Node" parent="."] [node name="PacXonGridInteractor" type="Node" parent="." unique_id=1036082136]
script = ExtResource("42_xuhvf") script = ExtResource("42_xuhvf")
metadata/_custom_type_script = "uid://c00siqtssccr6" metadata/_custom_type_script = "uid://c00siqtssccr6"
[node name="PacXonTrailComponent" type="Line2D" parent="."] [node name="PacXonTrailComponent" type="Line2D" parent="." unique_id=100969687]
script = ExtResource("44_uno3u") script = ExtResource("44_uno3u")
metadata/_custom_type_script = "uid://cmk4m7mplqnrm" metadata/_custom_type_script = "uid://cmk4m7mplqnrm"
[node name="Feet" type="Marker2D" parent="."] [node name="Feet" type="Marker2D" parent="." unique_id=1308840991]
position = Vector2(0, 16) position = Vector2(0, 16)
[node name="FootstepGfx" type="Node2D" parent="." node_paths=PackedStringArray("_controller", "_marker")] [node name="FootstepGfx" type="Node2D" parent="." unique_id=362059837 node_paths=PackedStringArray("_controller", "_marker")]
script = ExtResource("46_6n1ss") script = ExtResource("46_6n1ss")
_particles = ExtResource("45_bl1gx") _particles = ExtResource("45_bl1gx")
_controller = NodePath("..") _controller = NodePath("..")
@@ -323,7 +288,7 @@ _minMoveSpeed = 4.0
_randomOffsetRange = 0.3 _randomOffsetRange = 0.3
metadata/_custom_type_script = "uid://d3ksrjt1ek4gi" metadata/_custom_type_script = "uid://d3ksrjt1ek4gi"
[node name="JumpGfxComponent" type="Node2D" parent="." node_paths=PackedStringArray("Controller")] [node name="JumpGfxComponent" type="Node2D" parent="." unique_id=1468920790 node_paths=PackedStringArray("Controller")]
script = ExtResource("47_oefns") script = ExtResource("47_oefns")
ParticleScene = ExtResource("48_bnap0") ParticleScene = ExtResource("48_bnap0")
Controller = NodePath("..") Controller = NodePath("..")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://cm3rixnnev1pg"] [gd_scene format=3 uid="uid://cm3rixnnev1pg"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ctugi"] [ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ctugi"]
[ext_resource type="Script" uid="uid://bgbnof7aeydmq" path="res://scripts/components/JumpPadComponent.cs" id="2_huktk"] [ext_resource type="Script" uid="uid://bgbnof7aeydmq" path="res://scripts/components/JumpPadComponent.cs" id="2_huktk"]
@@ -6,23 +6,23 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ci3ij"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ci3ij"]
size = Vector2(16, 6) size = Vector2(16, 6)
[node name="Jump pad" type="Area2D"] [node name="Jump pad" type="Area2D" unique_id=986549607]
collision_layer = 0 collision_layer = 0
collision_mask = 4 collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1755302504]
position = Vector2(0, 5) position = Vector2(0, 5)
shape = SubResource("RectangleShape2D_ci3ij") shape = SubResource("RectangleShape2D_ci3ij")
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="." unique_id=1150967280]
texture = ExtResource("1_ctugi") texture = ExtResource("1_ctugi")
hframes = 12 hframes = 12
vframes = 12 vframes = 12
frame = 120 frame = 120
[node name="JumpPadComponent" type="Node" parent="." node_paths=PackedStringArray("Area", "Sprite")] [node name="JumpPadComponent" type="Node" parent="." unique_id=1295810804 node_paths=PackedStringArray("Area", "Sprite")]
script = ExtResource("2_huktk") script = ExtResource("2_huktk")
JumpForce = 1110.0 JumpForce = 1210.0
Area = NodePath("..") Area = NodePath("..")
Sprite = NodePath("../Sprite2D") Sprite = NodePath("../Sprite2D")
StartAnimationIndex = 120 StartAnimationIndex = 120

View File

@@ -1,18 +1,20 @@
[gd_scene load_steps=4 format=3 uid="uid://lpovacvt3yyj"] [gd_scene format=3 uid="uid://lpovacvt3yyj"]
[ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="1_r82pf"] [ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="1_r82pf"]
[ext_resource type="Script" uid="uid://dtv2r7q4elgre" path="res://scripts/components/SpaceshipEnterComponent.cs" id="2_wanmd"] [ext_resource type="Script" uid="uid://dtv2r7q4elgre" path="res://scripts/components/SpaceshipEnterComponent.cs" id="2_wanmd"]
[ext_resource type="Resource" uid="uid://d033qwwfs3i72" path="res://resources/movement_presets/spaceship_movement.tres" id="2_yda36"]
[sub_resource type="CircleShape2D" id="CircleShape2D_wanmd"] [sub_resource type="CircleShape2D" id="CircleShape2D_wanmd"]
radius = 16.1245 radius = 16.1245
[node name="Spaceship Enter" type="Area2D"] [node name="Spaceship Enter" type="Area2D" unique_id=916428603]
collision_layer = 0 collision_layer = 0
collision_mask = 4 collision_mask = 4
script = ExtResource("2_wanmd") script = ExtResource("2_wanmd")
Preset = ExtResource("2_yda36")
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="." unique_id=433507900]
texture = ExtResource("1_r82pf") texture = ExtResource("1_r82pf")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=993596426]
shape = SubResource("CircleShape2D_wanmd") shape = SubResource("CircleShape2D_wanmd")

View File

@@ -1,14 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://dkqa3q6j2gof4"] [gd_scene format=3 uid="uid://dkqa3q6j2gof4"]
[ext_resource type="Script" uid="uid://d3gfg05ll8uw3" path="res://scripts/components/SpaceshipExitComponent.cs" id="1_1cmfv"] [ext_resource type="Script" uid="uid://d3gfg05ll8uw3" path="res://scripts/components/SpaceshipExitComponent.cs" id="1_1cmfv"]
[ext_resource type="Resource" uid="uid://vgutbpovj8hc" path="res://resources/movement_presets/platform_movement.tres" id="2_njt46"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_njt46"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_njt46"]
[node name="Spaceship exit" type="Area2D" node_paths=PackedStringArray("Area")] [node name="Spaceship exit" type="Area2D" unique_id=922920366]
collision_layer = 0 collision_layer = 0
collision_mask = 4 collision_mask = 4
script = ExtResource("1_1cmfv") script = ExtResource("1_1cmfv")
Area = NodePath(".") Preset = ExtResource("2_njt46")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1697409658]
shape = SubResource("RectangleShape2D_njt46") shape = SubResource("RectangleShape2D_njt46")

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://cala7bpo1v4no"] [gd_scene format=3 uid="uid://cala7bpo1v4no"]
[ext_resource type="Script" uid="uid://chgw53qwt7rt8" path="res://scripts/components/Movement/GravityAbility.cs" id="1_tn5sj"] [ext_resource type="Script" uid="uid://chgw53qwt7rt8" path="res://scripts/components/Movement/GravityAbility.cs" id="1_tn5sj"]
[node name="GravityAbility" type="Node"] [node name="GravityAbility" type="Node" unique_id=711941081]
script = ExtResource("1_tn5sj") script = ExtResource("1_tn5sj")
DescendGravity = 1000.0
metadata/_custom_type_script = "uid://chgw53qwt7rt8" metadata/_custom_type_script = "uid://chgw53qwt7rt8"

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://d0r5edxnx5jqx"] [gd_scene format=3 uid="uid://d0r5edxnx5jqx"]
[ext_resource type="Script" uid="uid://ccksp2e76s7sr" path="res://scripts/components/Movement/VariableJumpAbility.cs" id="1_y30i5"] [ext_resource type="Script" uid="uid://ccksp2e76s7sr" path="res://scripts/components/Movement/VariableJumpAbility.cs" id="1_y30i5"]
[node name="VariableJumpAbility" type="Node"] [node name="VariableJumpAbility" type="Node" unique_id=735694377]
script = ExtResource("1_y30i5") script = ExtResource("1_y30i5")
JumpHeight = 112.0
JumpCutMultiplier = 0.507 JumpCutMultiplier = 0.507
metadata/_custom_type_script = "uid://ccksp2e76s7sr" metadata/_custom_type_script = "uid://ccksp2e76s7sr"

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://bi6v7u17vg1ww"] [gd_scene format=3 uid="uid://bi6v7u17vg1ww"]
[ext_resource type="Script" uid="uid://dru77vj07e18s" path="res://Autoloads/SkillManager.cs" id="1_31033"] [ext_resource type="Script" uid="uid://dru77vj07e18s" path="res://Autoloads/SkillManager.cs" id="1_31033"]
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="2_87da4"] [ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="2_87da4"]
@@ -12,6 +12,6 @@
[ext_resource type="Resource" uid="uid://d12defdtmlk0u" path="res://resources/skills/brick_shield.tres" id="11_6wy8o"] [ext_resource type="Resource" uid="uid://d12defdtmlk0u" path="res://resources/skills/brick_shield.tres" id="11_6wy8o"]
[ext_resource type="Resource" uid="uid://dghnl301o1aiy" path="res://resources/skills/brick_armor.tres" id="12_gib8v"] [ext_resource type="Resource" uid="uid://dghnl301o1aiy" path="res://resources/skills/brick_armor.tres" id="12_gib8v"]
[node name="SkillManager" type="Node"] [node name="SkillManager" type="Node" unique_id=1205356464]
script = ExtResource("1_31033") script = ExtResource("1_31033")
AvailableSkills = Array[ExtResource("2_87da4")]([ExtResource("3_shjvi"), ExtResource("4_53vnv"), ExtResource("5_77gav"), ExtResource("6_gib8v"), ExtResource("10_gib8v"), ExtResource("8_87da4"), ExtResource("9_77gav"), ExtResource("11_6wy8o"), ExtResource("12_gib8v")]) AvailableSkills = Array[ExtResource("2_87da4")]([ExtResource("3_shjvi"), ExtResource("4_53vnv"), ExtResource("5_77gav"), ExtResource("6_gib8v"), ExtResource("10_gib8v"), ExtResource("8_87da4"), ExtResource("9_77gav"), ExtResource("11_6wy8o"), ExtResource("12_gib8v")])

View File

@@ -0,0 +1,77 @@
[gd_scene load_steps=3 format=3 uid="uid://display_settings_scene"]
[ext_resource type="Script" uid="uid://display_settings_script" path="res://scripts/UI/DisplaySettings.cs" id="1_dispset"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dispset"]
bg_color = Color(0, 0, 0, 1)
[node name="Display settings" type="Control" node_paths=PackedStringArray("WindowModeButton", "ResolutionButton", "DisplaySettingsControl")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 6
size_flags_vertical = 6
script = ExtResource("1_dispset")
WindowModeButton = NodePath("PanelContainer/MarginContainer/VBoxContainer/Window Mode/WindowModeButton")
ResolutionButton = NodePath("PanelContainer/MarginContainer/VBoxContainer/Resolution/ResolutionButton")
DisplaySettingsControl = 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_dispset")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Display" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "DISPLAY"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
[node name="Spacer" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 32)
layout_mode = 2
size_flags_vertical = 3
[node name="Window Mode" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Window Mode"]
layout_mode = 2
text = "WINDOW_MODE"
horizontal_alignment = 1
[node name="WindowModeButton" type="OptionButton" parent="PanelContainer/MarginContainer/VBoxContainer/Window Mode"]
layout_mode = 2
[node name="Resolution" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Resolution"]
layout_mode = 2
text = "RESOLUTION"
horizontal_alignment = 1
[node name="ResolutionButton" type="OptionButton" parent="PanelContainer/MarginContainer/VBoxContainer/Resolution"]
layout_mode = 2

View File

@@ -0,0 +1,97 @@
[gd_scene load_steps=3 format=3 uid="uid://gameplay_settings_scene"]
[ext_resource type="Script" uid="uid://gameplay_settings_script" path="res://scripts/UI/GameplaySettings.cs" id="1_gameplay"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gameplay"]
bg_color = Color(0, 0, 0, 1)
[node name="Gameplay Settings" type="Control" node_paths=PackedStringArray("DeadzoneSlider", "DeadzoneValueLabel", "SensitivitySlider", "SensitivityValueLabel", "GameplaySettingsControl")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 6
size_flags_vertical = 6
script = ExtResource("1_gameplay")
DeadzoneSlider = NodePath("PanelContainer/MarginContainer/VBoxContainer/Deadzone/HSlider")
DeadzoneValueLabel = NodePath("PanelContainer/MarginContainer/VBoxContainer/Deadzone/HBoxContainer/DeadzoneValueLabel")
SensitivitySlider = NodePath("PanelContainer/MarginContainer/VBoxContainer/Sensitivity/HSlider")
SensitivityValueLabel = NodePath("PanelContainer/MarginContainer/VBoxContainer/Sensitivity/HBoxContainer/SensitivityValueLabel")
GameplaySettingsControl = 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_gameplay")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Gameplay" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "GAMEPLAY"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
[node name="Spacer" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 32)
layout_mode = 2
size_flags_vertical = 3
[node name="Deadzone" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Deadzone"]
layout_mode = 2
[node name="DeadzoneLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Deadzone/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "GAMEPAD_DEADZONE"
[node name="DeadzoneValueLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Deadzone/HBoxContainer"]
layout_mode = 2
text = "0.20"
[node name="HSlider" type="HSlider" parent="PanelContainer/MarginContainer/VBoxContainer/Deadzone"]
custom_minimum_size = Vector2(64, 0)
layout_mode = 2
value = 0.2
[node name="Sensitivity" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Sensitivity"]
layout_mode = 2
[node name="SensitivityLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Sensitivity/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "GAMEPAD_SENSITIVITY"
[node name="SensitivityValueLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Sensitivity/HBoxContainer"]
layout_mode = 2
text = "1.00"
[node name="HSlider" type="HSlider" parent="PanelContainer/MarginContainer/VBoxContainer/Sensitivity"]
custom_minimum_size = Vector2(64, 0)
layout_mode = 2
value = 1.0

View File

@@ -1,17 +1,23 @@
[gd_scene load_steps=3 format=3 uid="uid://cvfsbiy5ggrpg"] [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="PackedScene" uid="uid://bxpr4m7lq7clh" path="res://objects/ui/input_button.tscn" id="1_h8s4o"]
[ext_resource type="Script" uid="uid://input_settings_script" path="res://scripts/UI/InputSettings.cs" id="2_inputs"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_se25o"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_se25o"]
bg_color = Color(0, 0, 0, 1) bg_color = Color(0, 0, 0, 1)
[node name="Input Settings" type="Control"] [node name="Input Settings" type="Control" node_paths=PackedStringArray("ActionsContainer", "ResetButton", "InputSettingsControl")]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("2_inputs")
ActionsContainer = NodePath("PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/Actions")
ResetButton = NodePath("PanelContainer/MarginContainer/VBoxContainer/Reset to default Button")
InputSettingsControl = NodePath(".")
InputButtonScene = ExtResource("1_h8s4o")
[node name="PanelContainer" type="PanelContainer" parent="."] [node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1 layout_mode = 1
@@ -48,24 +54,6 @@ layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_constants/separation = 8 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"] [node name="Reset to default Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "RESET_TO_DEFAULT_BUTTON" text = "RESET_TO_DEFAULT_BUTTON"

View File

@@ -4,6 +4,7 @@
[ext_resource type="Script" uid="uid://vokgv56bjpf1" path="res://scripts/UI/MarketplaceButton.cs" id="2_vb2qn"] [ext_resource type="Script" uid="uid://vokgv56bjpf1" path="res://scripts/UI/MarketplaceButton.cs" id="2_vb2qn"]
[node name="MarketplaceButton" type="Button" node_paths=PackedStringArray("SkillLevelContainer")] [node name="MarketplaceButton" type="Button" node_paths=PackedStringArray("SkillLevelContainer")]
focus_mode = 2
offset_right = 8.0 offset_right = 8.0
offset_bottom = 8.0 offset_bottom = 8.0
size_flags_horizontal = 3 size_flags_horizontal = 3

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://i6mnjbjcoqe5"] [gd_scene format=3 uid="uid://i6mnjbjcoqe5"]
[ext_resource type="Script" uid="uid://cakgxndurgfa3" path="res://scripts/UI/PauseMenu.cs" id="1_h4pd5"] [ext_resource type="Script" uid="uid://cakgxndurgfa3" path="res://scripts/UI/PauseMenu.cs" id="1_h4pd5"]
[ext_resource type="PackedScene" uid="uid://cl00e2ocomk3m" path="res://scenes/main_menu.tscn" id="2_h4pd5"] [ext_resource type="PackedScene" uid="uid://cl00e2ocomk3m" path="res://scenes/main_menu.tscn" id="2_h4pd5"]
@@ -6,7 +6,7 @@
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g4ivv"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g4ivv"]
bg_color = Color(0, 0, 0, 1) bg_color = Color(0, 0, 0, 1)
[node name="Pause menu" type="Control" node_paths=PackedStringArray("PauseMenuControl", "ResumeButton", "MainMenuButton", "QuitButton", "SettingsButton")] [node name="Pause menu" type="Control" unique_id=923659871 node_paths=PackedStringArray("PauseMenuControl", "ResumeButton", "MainMenuButton", "QuitButton", "SettingsButton")]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@@ -23,7 +23,7 @@ QuitButton = NodePath("PanelContainer/MarginContainer/VBoxContainer/Quit game Bu
SettingsButton = NodePath("PanelContainer/MarginContainer/VBoxContainer/Settings Button") SettingsButton = NodePath("PanelContainer/MarginContainer/VBoxContainer/Settings Button")
MainMenuScene = ExtResource("2_h4pd5") MainMenuScene = ExtResource("2_h4pd5")
[node name="PanelContainer" type="PanelContainer" parent="."] [node name="PanelContainer" type="PanelContainer" parent="." unique_id=1782689001]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@@ -32,46 +32,52 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_g4ivv") theme_override_styles/panel = SubResource("StyleBoxFlat_g4ivv")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] [node name="MarginContainer" type="MarginContainer" parent="PanelContainer" unique_id=824088919]
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_left = 8 theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8 theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8 theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8 theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer" unique_id=1826945529]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 4 size_flags_vertical = 4
[node name="Pause" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Pause" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer" unique_id=1706564131]
layout_mode = 2 layout_mode = 2
text = "PAUSE" text = "PAUSE"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
uppercase = true uppercase = true
[node name="Spacer" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Spacer" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer" unique_id=868621584]
custom_minimum_size = Vector2(0, 32) custom_minimum_size = Vector2(0, 32)
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
[node name="Resume Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Resume Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer" unique_id=826636099]
layout_mode = 2 layout_mode = 2
focus_next = NodePath("../Settings Button")
text = "RESUME_BUTTON" text = "RESUME_BUTTON"
flat = true flat = true
[node name="Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer" unique_id=334350065]
layout_mode = 2 layout_mode = 2
focus_next = NodePath("../Exit to menu Button")
focus_previous = NodePath("../Resume Button")
text = "SETTINGS_BUTTON" text = "SETTINGS_BUTTON"
flat = true flat = true
[node name="Exit to menu Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Exit to menu Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer" unique_id=683937353]
layout_mode = 2 layout_mode = 2
focus_next = NodePath("../Quit game Button")
focus_previous = NodePath("../Settings Button")
text = "EXIT_TO_MENU_BUTTON" text = "EXIT_TO_MENU_BUTTON"
flat = true flat = true
[node name="Quit game Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Quit game Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer" unique_id=2008979602]
layout_mode = 2 layout_mode = 2
focus_previous = NodePath("../Exit to menu Button")
text = "QUIT_BUTTON" text = "QUIT_BUTTON"
flat = true flat = true

View File

@@ -53,13 +53,11 @@ size_flags_vertical = 3
[node name="Input Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Input Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
disabled = true
text = "INPUT_BUTTON" text = "INPUT_BUTTON"
flat = true flat = true
[node name="Display Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Display Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
disabled = true
text = "DISPLAY_BUTTON" text = "DISPLAY_BUTTON"
flat = true flat = true
@@ -70,7 +68,6 @@ flat = true
[node name="Gameplay Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="Gameplay Settings Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
disabled = true
text = "GAMEPLAY_BUTTON" text = "GAMEPLAY_BUTTON"
flat = true flat = true

View File

@@ -4,6 +4,7 @@
[ext_resource type="Script" uid="uid://bw8dlgq86jrtt" path="res://scripts/UI/SkillButton.cs" id="2_m2732"] [ext_resource type="Script" uid="uid://bw8dlgq86jrtt" path="res://scripts/UI/SkillButton.cs" id="2_m2732"]
[node name="SkillButton" type="Button"] [node name="SkillButton" type="Button"]
focus_mode = 2
offset_right = 8.0 offset_right = 8.0
offset_bottom = 8.0 offset_bottom = 8.0
size_flags_horizontal = 3 size_flags_horizontal = 3

View File

@@ -37,6 +37,8 @@ PhantomCameraManager="*res://addons/phantom_camera/scripts/managers/phantom_came
AudioController="*res://objects/audio_controller.tscn" AudioController="*res://objects/audio_controller.tscn"
UIManager="*res://Autoloads/UIManager.cs" UIManager="*res://Autoloads/UIManager.cs"
ConfigFileHandler="*res://Autoloads/ConfigFileHandler.cs" ConfigFileHandler="*res://Autoloads/ConfigFileHandler.cs"
SettingsManager="*res://Autoloads/SettingsManager.cs"
InputDeviceManager="*res://Autoloads/InputDeviceManager.cs"
SaveSystem="*res://Autoloads/SaveSystem.cs" SaveSystem="*res://Autoloads/SaveSystem.cs"
ConsoleManager="*res://Autoloads/ConsoleManager.cs" ConsoleManager="*res://Autoloads/ConsoleManager.cs"
LimboConsole="*uid://dyxornv8vwibg" LimboConsole="*uid://dyxornv8vwibg"

View File

@@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="MovementPreset" format=3 uid="uid://vgutbpovj8hc"]
[ext_resource type="Script" uid="uid://tt1los3lafsi" path="res://scripts/Resources/MovementPreset.cs" id="1_0yvgi"]
[ext_resource type="PackedScene" uid="uid://bcv8kx6bc7u5e" path="res://objects/movement_abilities/ground_ability.tscn" id="1_sll4h"]
[ext_resource type="PackedScene" uid="uid://d0r5edxnx5jqx" path="res://objects/movement_abilities/variable_jump_ability.tscn" id="2_g20lq"]
[ext_resource type="PackedScene" uid="uid://cala7bpo1v4no" path="res://objects/movement_abilities/gravity_ability.tscn" id="3_085b1"]
[ext_resource type="PackedScene" uid="uid://bty3jq8u0pxkf" path="res://objects/movement_abilities/one_way_platform_ability.tscn" id="4_yebn0"]
[resource]
script = ExtResource("1_0yvgi")
Abilities = [ExtResource("1_sll4h"), ExtResource("2_g20lq"), ExtResource("3_085b1"), ExtResource("4_yebn0")]
metadata/_custom_type_script = "uid://tt1los3lafsi"

View File

@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="MovementPreset" format=3 uid="uid://d033qwwfs3i72"]
[ext_resource type="Script" uid="uid://tt1los3lafsi" path="res://scripts/Resources/MovementPreset.cs" id="1_dfw61"]
[ext_resource type="PackedScene" uid="uid://bu3vuxlrvoo1t" path="res://objects/movement_abilities/spaceship_ability.tscn" id="1_hadk8"]
[resource]
script = ExtResource("1_dfw61")
Abilities = [ExtResource("1_hadk8")]
metadata/_custom_type_script = "uid://tt1los3lafsi"

View File

@@ -67,7 +67,7 @@ transition = 3
[node name="Brick Player" parent="." unique_id=1617406140 instance=ExtResource("1_dnj2y")] [node name="Brick Player" parent="." unique_id=1617406140 instance=ExtResource("1_dnj2y")]
z_index = 10 z_index = 10
[node name="HitParticles" parent="Brick Player" index="23"] [node name="HitParticles" parent="Brick Player" index="23" unique_id=1322585720]
process_material = SubResource("ParticleProcessMaterial_84xgs") process_material = SubResource("ParticleProcessMaterial_84xgs")
[node name="WorldEnvironment" parent="." unique_id=1232714328 instance=ExtResource("2_1vw1j")] [node name="WorldEnvironment" parent="." unique_id=1232714328 instance=ExtResource("2_1vw1j")]

View File

@@ -1,10 +1,12 @@
[gd_scene load_steps=6 format=3 uid="uid://cl00e2ocomk3m"] [gd_scene load_steps=8 format=3 uid="uid://cl00e2ocomk3m"]
[ext_resource type="PackedScene" uid="uid://8b6ol5sssbgo" path="res://objects/ui/main_menu.tscn" id="1_ekxnf"] [ext_resource type="PackedScene" uid="uid://8b6ol5sssbgo" path="res://objects/ui/main_menu.tscn" id="1_ekxnf"]
[ext_resource type="PackedScene" uid="uid://y0ae6e7t70fj" path="res://objects/ui/settings_menu.tscn" id="2_bqqt6"] [ext_resource type="PackedScene" uid="uid://y0ae6e7t70fj" path="res://objects/ui/settings_menu.tscn" id="2_bqqt6"]
[ext_resource type="PackedScene" uid="uid://bwgmrcyj4mvu" path="res://objects/ui/credits.tscn" id="3_bqqt6"] [ext_resource type="PackedScene" uid="uid://bwgmrcyj4mvu" path="res://objects/ui/credits.tscn" id="3_bqqt6"]
[ext_resource type="PackedScene" uid="uid://b5fx1vdfky307" path="res://objects/ui/audio_settings.tscn" id="4_8ln24"] [ext_resource type="PackedScene" uid="uid://b5fx1vdfky307" path="res://objects/ui/audio_settings.tscn" id="4_8ln24"]
[ext_resource type="PackedScene" uid="uid://cvfsbiy5ggrpg" path="res://objects/ui/input_settings.tscn" id="5_rtw2f"] [ext_resource type="PackedScene" uid="uid://cvfsbiy5ggrpg" path="res://objects/ui/input_settings.tscn" id="5_rtw2f"]
[ext_resource type="PackedScene" uid="uid://display_settings_scene" path="res://objects/ui/display_settings.tscn" id="6_dispset"]
[ext_resource type="PackedScene" uid="uid://gameplay_settings_scene" path="res://objects/ui/gameplay_settings.tscn" id="7_gameplay"]
[node name="Main menu" type="CanvasLayer"] [node name="Main menu" type="CanvasLayer"]
@@ -28,14 +30,8 @@ visible = false
[node name="Input Settings" parent="." instance=ExtResource("5_rtw2f")] [node name="Input Settings" parent="." instance=ExtResource("5_rtw2f")]
visible = false visible = false
[node name="Gameplay Settings" type="Control" parent="."] [node name="Gameplay Settings" parent="." instance=ExtResource("7_gameplay")]
layout_mode = 3 visible = false
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="Display Settings" type="Control" parent="."] [node name="Display Settings" parent="." instance=ExtResource("6_dispset")]
layout_mode = 3 visible = false
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0

View File

@@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using Godot; using Godot;
using Mr.BrickAdventures.scripts.components; using Mr.BrickAdventures.scripts.components;
using Mr.BrickAdventures.scripts.Resources;
namespace Mr.BrickAdventures.scripts; namespace Mr.BrickAdventures.scripts;
@@ -8,17 +9,17 @@ namespace Mr.BrickAdventures.scripts;
public partial class PacXonLevel : Node public partial class PacXonLevel : Node
{ {
[Export] public PlayerController Player { get; set; } [Export] public PlayerController Player { get; set; }
[Export] public MovementPreset GridPreset { get; set; }
[Export] public PacXonGridManager GridManager { get; set; } [Export] public PacXonGridManager GridManager { get; set; }
[Export] public Node GhostContainer { get; set; } [Export] public Node GhostContainer { get; set; }
[Export] public Label PercentageLabel { get; set; } [Export] public Label PercentageLabel { get; set; }
private const float WinPercentage = 0.90f; private const float WinPercentage = 0.90f;
public override void _Ready() public override void _Ready()
{ {
var ghosts = GhostContainer.GetChildren().OfType<Node2D>().ToList(); var ghosts = GhostContainer.GetChildren().OfType<Node2D>().ToList();
Player.ClearMovementAbilities(); Player.ApplyPreset(GridPreset);
Player.SetGridMovement();
foreach (var ghost in ghosts) foreach (var ghost in ghosts)
{ {

View File

@@ -0,0 +1,9 @@
using Godot;
namespace Mr.BrickAdventures.scripts.Resources;
[GlobalClass]
public partial class MovementPreset : Resource
{
[Export] public PackedScene[] Abilities { get; set; } = [];
}

View File

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

View File

@@ -16,19 +16,45 @@ public partial class AudioSettings : Control
public override void _Ready() public override void _Ready()
{ {
MasterVolumeSlider.FocusMode = Control.FocusModeEnum.All;
MusicVolumeSlider.FocusMode = Control.FocusModeEnum.All;
SfxVolumeSlider.FocusMode = Control.FocusModeEnum.All;
Initialize(); Initialize();
MasterVolumeSlider.ValueChanged += OnMasterVolumeChanged; MasterVolumeSlider.ValueChanged += OnMasterVolumeChanged;
MusicVolumeSlider.ValueChanged += OnMusicVolumeChanged; MusicVolumeSlider.ValueChanged += OnMusicVolumeChanged;
SfxVolumeSlider.ValueChanged += OnSfxVolumeChanged; SfxVolumeSlider.ValueChanged += OnSfxVolumeChanged;
LoadSettings(); LoadSettings();
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
AudioSettingsControl.VisibilityChanged += OnVisibilityChanged;
} }
public override void _ExitTree() public override void _ExitTree()
{ {
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
AudioSettingsControl.VisibilityChanged -= OnVisibilityChanged;
SaveSettings(); SaveSettings();
} }
private void OnVisibilityChanged()
{
if (AudioSettingsControl.IsVisibleInTree() && InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && AudioSettingsControl.IsVisibleInTree())
GrabFirstFocus();
}
private void GrabFirstFocus() => MasterVolumeSlider.GrabFocus();
public override void _UnhandledInput(InputEvent @event) public override void _UnhandledInput(InputEvent @event)
{ {
if (!@event.IsActionReleased("ui_cancel")) return; if (!@event.IsActionReleased("ui_cancel")) return;

View File

@@ -0,0 +1,125 @@
using Godot;
using Mr.BrickAdventures.Autoloads;
namespace Mr.BrickAdventures.scripts.UI;
public partial class DisplaySettings : Control
{
[Export] public OptionButton WindowModeButton { get; set; }
[Export] public OptionButton ResolutionButton { get; set; }
[Export] public Control DisplaySettingsControl { get; set; }
private UIManager UIManager => UIManager.Instance;
public override void _Ready()
{
PopulateWindowMode();
PopulateResolutions();
WindowModeButton.ItemSelected += OnWindowModeChanged;
ResolutionButton.ItemSelected += OnResolutionChanged;
WindowModeButton.FocusMode = Control.FocusModeEnum.All;
ResolutionButton.FocusMode = Control.FocusModeEnum.All;
LoadSettings();
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
DisplaySettingsControl.VisibilityChanged += OnVisibilityChanged;
}
public override void _ExitTree()
{
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
DisplaySettingsControl.VisibilityChanged -= OnVisibilityChanged;
SettingsManager.Instance?.SaveDisplaySettings();
}
public override void _UnhandledInput(InputEvent @event)
{
if (!@event.IsActionReleased("ui_cancel")) return;
if (!UIManager.IsScreenOnTop(DisplaySettingsControl)) return;
SettingsManager.Instance?.SaveDisplaySettings();
UIManager.PopScreen();
}
private void OnVisibilityChanged()
{
if (DisplaySettingsControl.IsVisibleInTree() && InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && DisplaySettingsControl.IsVisibleInTree())
GrabFirstFocus();
}
private void GrabFirstFocus() => WindowModeButton.GrabFocus();
private void PopulateWindowMode()
{
WindowModeButton.Clear();
WindowModeButton.AddItem("Fullscreen", 0);
WindowModeButton.AddItem("Borderless", 1);
WindowModeButton.AddItem("Windowed", 2);
}
private void PopulateResolutions()
{
ResolutionButton.Clear();
foreach (var res in SettingsManager.Instance.GetAllResolutions())
{
string label = $"{res.X}×{res.Y}";
ResolutionButton.AddItem(label);
}
}
private void OnWindowModeChanged(long idx)
{
string mode = idx switch
{
0 => "fullscreen",
1 => "borderless",
_ => "windowed"
};
SettingsManager.Instance.WindowMode = mode;
SettingsManager.Instance.ApplyDisplaySettings();
ResolutionButton.Disabled = mode == "fullscreen";
SettingsManager.Instance.SaveDisplaySettings();
}
private void OnResolutionChanged(long idx)
{
var resolutions = SettingsManager.Instance.GetAllResolutions();
if (idx < 0 || idx >= resolutions.Count) return;
var res = resolutions[(int)idx];
SettingsManager.Instance.Resolution = res;
SettingsManager.Instance.ApplyDisplaySettings();
SettingsManager.Instance.SaveDisplaySettings();
}
private void LoadSettings()
{
var mode = SettingsManager.Instance.WindowMode;
WindowModeButton.Selected = mode switch
{
"fullscreen" => 0,
"borderless" => 1,
_ => 2
};
ResolutionButton.Disabled = mode == "fullscreen";
var resolution = SettingsManager.Instance.Resolution;
var resolutions = SettingsManager.Instance.GetAllResolutions();
int resIdx = resolutions.IndexOf(resolution);
if (resIdx >= 0)
ResolutionButton.Selected = resIdx;
}
}

View File

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

View File

@@ -13,8 +13,27 @@ public partial class GameOverScreen : Control
public override void _Ready() public override void _Ready()
{ {
RestartButton.FocusMode = Control.FocusModeEnum.All;
MainMenuButton.FocusMode = Control.FocusModeEnum.All;
RestartButton.Pressed += OnRestartClicked; RestartButton.Pressed += OnRestartClicked;
MainMenuButton.Pressed += OnMainMenuClicked; MainMenuButton.Pressed += OnMainMenuClicked;
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
}
public override void _ExitTree()
{
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && GameOverPanel.IsVisibleInTree())
RestartButton.GrabFocus();
} }
private void OnMainMenuClicked() private void OnMainMenuClicked()
@@ -33,5 +52,7 @@ public partial class GameOverScreen : Control
if (GameStateStore.Instance?.Player.Lives != 0) return; if (GameStateStore.Instance?.Player.Lives != 0) return;
GameOverPanel.Show(); GameOverPanel.Show();
if (InputDeviceManager.Instance?.IsPointerless == true)
RestartButton.GrabFocus();
} }
} }

View File

@@ -0,0 +1,97 @@
using Godot;
using Mr.BrickAdventures.Autoloads;
namespace Mr.BrickAdventures.scripts.UI;
public partial class GameplaySettings : Control
{
[Export] public HSlider DeadzoneSlider { get; set; }
[Export] public Label DeadzoneValueLabel { get; set; }
[Export] public HSlider SensitivitySlider { get; set; }
[Export] public Label SensitivityValueLabel { get; set; }
[Export] public Control GameplaySettingsControl { get; set; }
private UIManager UIManager => UIManager.Instance;
public override void _Ready()
{
DeadzoneSlider.FocusMode = Control.FocusModeEnum.All;
SensitivitySlider.FocusMode = Control.FocusModeEnum.All;
DeadzoneSlider.MinValue = 0.05;
DeadzoneSlider.MaxValue = 0.5;
DeadzoneSlider.Step = 0.05;
DeadzoneSlider.Value = 0.2;
SensitivitySlider.MinValue = 0.5;
SensitivitySlider.MaxValue = 2.0;
SensitivitySlider.Step = 0.1;
SensitivitySlider.Value = 1.0;
LoadSettings();
DeadzoneSlider.ValueChanged += OnDeadzoneChanged;
SensitivitySlider.ValueChanged += OnSensitivityChanged;
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
GameplaySettingsControl.VisibilityChanged += OnVisibilityChanged;
}
public override void _ExitTree()
{
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
GameplaySettingsControl.VisibilityChanged -= OnVisibilityChanged;
SaveSettings();
}
public override void _UnhandledInput(InputEvent @event)
{
if (!@event.IsActionReleased("ui_cancel")) return;
if (!UIManager.IsScreenOnTop(GameplaySettingsControl)) return;
SaveSettings();
UIManager.PopScreen();
}
private void OnVisibilityChanged()
{
if (GameplaySettingsControl.IsVisibleInTree() && InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && GameplaySettingsControl.IsVisibleInTree())
GrabFirstFocus();
}
private void GrabFirstFocus() => DeadzoneSlider.GrabFocus();
private void OnDeadzoneChanged(double value)
{
SettingsManager.Instance.GamepadDeadzone = (float)value;
SettingsManager.Instance.ApplyGamepadDeadzone();
DeadzoneValueLabel.Text = $"{value:F2}";
SaveSettings();
}
private void OnSensitivityChanged(double value)
{
SettingsManager.Instance.GamepadSensitivity = (float)value;
SensitivityValueLabel.Text = $"{value:F2}";
SaveSettings();
}
private void LoadSettings()
{
DeadzoneSlider.Value = SettingsManager.Instance.GamepadDeadzone;
SensitivitySlider.Value = SettingsManager.Instance.GamepadSensitivity;
DeadzoneValueLabel.Text = $"{SettingsManager.Instance.GamepadDeadzone:F2}";
SensitivityValueLabel.Text = $"{SettingsManager.Instance.GamepadSensitivity:F2}";
}
private void SaveSettings() => SettingsManager.Instance.SaveGameplaySettings();
}

View File

@@ -0,0 +1 @@
uid://18e3imrmq1u6

201
scripts/UI/InputSettings.cs Normal file
View File

@@ -0,0 +1,201 @@
using Godot;
using Mr.BrickAdventures.Autoloads;
namespace Mr.BrickAdventures.scripts.UI;
public partial class InputSettings : Control
{
[Export] public VBoxContainer ActionsContainer { get; set; }
[Export] public Button ResetButton { get; set; }
[Export] public Control InputSettingsControl { get; set; }
[Export] public PackedScene InputButtonScene { get; set; }
// When adding new game actions, update this list to make them remappable in settings.
private static readonly string[] RemappableActions =
["left", "right", "jump", "attack", "pause", "show_marketplace"];
private UIManager UIManager => UIManager.Instance;
private ConfigFileHandler ConfigFileHandler => ConfigFileHandler.Instance;
private string _rebindingAction;
private Button _rebindingButton;
private Label _rebindingLabel;
public override void _Ready()
{
PopulateActions();
ResetButton.FocusMode = FocusModeEnum.All;
ResetButton.Pressed += OnResetPressed;
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
InputSettingsControl.VisibilityChanged += OnVisibilityChanged;
}
public override void _ExitTree()
{
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
InputSettingsControl.VisibilityChanged -= OnVisibilityChanged;
}
public override void _UnhandledInput(InputEvent @event)
{
if (!IsVisibleInTree()) return;
if (_rebindingAction != null)
{
if (@event is InputEventKey keyEvent && keyEvent.Pressed && !keyEvent.Echo)
{
GetViewport().SetInputAsHandled();
TryBind(_rebindingAction, _rebindingButton, _rebindingLabel, keyEvent);
}
else if (@event.IsActionReleased("ui_cancel"))
{
GetViewport().SetInputAsHandled();
CancelRebind();
}
return;
}
if (!@event.IsActionReleased("ui_cancel")) return;
if (!UIManager.IsScreenOnTop(InputSettingsControl)) return;
UIManager.PopScreen();
}
private void PopulateActions()
{
foreach (Node child in ActionsContainer.GetChildren())
child.QueueFree();
foreach (var action in RemappableActions)
{
var row = InputButtonScene.Instantiate<Button>();
ActionsContainer.AddChild(row);
var labelAction = row.GetNode<Label>("MarginContainer/HBoxContainer/LabelAction");
var labelInput = row.GetNode<Label>("MarginContainer/HBoxContainer/LabelInput");
labelAction.Text = HumanizeAction(action);
labelInput.Text = GetKeyName(action);
row.FocusMode = FocusModeEnum.All;
var capturedAction = action;
var capturedLabel = labelInput;
var capturedRow = row;
row.Pressed += () => OnRowPressed(capturedAction, capturedRow, capturedLabel);
}
}
private void OnRowPressed(string action, Button row, Label labelInput)
{
if (_rebindingAction != null)
CancelRebind();
_rebindingAction = action;
_rebindingButton = row;
_rebindingLabel = labelInput;
labelInput.Text = "Press a key...";
}
private void TryBind(string action, Button row, Label labelInput, InputEventKey keyEvent)
{
var newKey = keyEvent.PhysicalKeycode;
// Conflict check
foreach (var other in RemappableActions)
{
if (other == action) continue;
var existing = GetCurrentKey(other);
if (existing == newKey)
{
labelInput.Text = $"Already used by {HumanizeAction(other)}!";
_rebindingAction = null;
_rebindingButton = null;
_rebindingLabel = null;
var capturedAction = action;
var capturedLabel = labelInput;
GetTree().CreateTimer(2.0).Timeout += () =>
{
if (IsInstanceValid(capturedLabel))
capturedLabel.Text = GetKeyName(capturedAction);
};
return;
}
}
// Apply
foreach (var ev in InputMap.ActionGetEvents(action))
{
if (ev is InputEventKey)
InputMap.ActionEraseEvent(action, ev);
}
InputMap.ActionAddEvent(action, new InputEventKey { PhysicalKeycode = keyEvent.PhysicalKeycode });
// Persist
SettingsManager.Instance.SaveInputSettings();
labelInput.Text = OS.GetKeycodeString(newKey);
_rebindingAction = null;
_rebindingButton = null;
_rebindingLabel = null;
}
private void CancelRebind()
{
if (_rebindingLabel != null)
_rebindingLabel.Text = GetKeyName(_rebindingAction);
_rebindingAction = null;
_rebindingButton = null;
_rebindingLabel = null;
}
private void OnResetPressed()
{
InputMap.LoadFromProjectSettings();
ConfigFileHandler.SettingsConfig.EraseSection("input_settings");
ConfigFileHandler.SettingsConfig.Save(ConfigFileHandler.SettingsPath);
PopulateActions();
}
private void OnVisibilityChanged()
{
if (InputSettingsControl.IsVisibleInTree() && InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && InputSettingsControl.IsVisibleInTree())
GrabFirstFocus();
}
private void GrabFirstFocus()
{
var children = ActionsContainer.GetChildren();
if (children.Count > 0 && children[0] is Button btn)
btn.GrabFocus();
}
private static Key GetCurrentKey(string action)
{
foreach (var ev in InputMap.ActionGetEvents(action))
{
if (ev is InputEventKey key)
return key.PhysicalKeycode;
}
return Key.None;
}
private static string GetKeyName(string action)
{
var key = GetCurrentKey(action);
return key == Key.None ? "---" : OS.GetKeycodeString(key);
}
private static string HumanizeAction(string action)
=> action.Replace("_", " ").ToUpper();
}

View File

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

View File

@@ -21,6 +21,11 @@ public partial class MainMenu : Control
public override void _Ready() public override void _Ready()
{ {
NewGameButton.FocusMode = Control.FocusModeEnum.All;
ContinueButton.FocusMode = Control.FocusModeEnum.All;
SettingsButton.FocusMode = Control.FocusModeEnum.All;
CreditsButton.FocusMode = Control.FocusModeEnum.All;
ExitButton.FocusMode = Control.FocusModeEnum.All;
NewGameButton.Pressed += OnNewGamePressed; NewGameButton.Pressed += OnNewGamePressed;
ContinueButton.Pressed += OnContinuePressed; ContinueButton.Pressed += OnContinuePressed;
@@ -31,6 +36,36 @@ public partial class MainMenu : Control
VersionLabel.Text = $"v. {ProjectSettings.GetSetting("application/config/version")}"; VersionLabel.Text = $"v. {ProjectSettings.GetSetting("application/config/version")}";
ContinueButton.Disabled = !SaveSystem.CheckSaveExists(); ContinueButton.Disabled = !SaveSystem.CheckSaveExists();
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
VisibilityChanged += OnVisibilityChanged;
if (InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
public override void _ExitTree()
{
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
VisibilityChanged -= OnVisibilityChanged;
}
private void OnVisibilityChanged()
{
if (IsVisibleInTree() && InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && IsVisibleInTree())
GrabFirstFocus();
}
private void GrabFirstFocus()
{
if (SaveSystem.CheckSaveExists()) if (SaveSystem.CheckSaveExists())
ContinueButton.GrabFocus(); ContinueButton.GrabFocus();
else else

View File

@@ -38,6 +38,9 @@ public partial class Marketplace : Control
SkillUnlockerComponent.SkillUnlocked += OnSkillUnlocked; SkillUnlockerComponent.SkillUnlocked += OnSkillUnlocked;
EventBus.Instance.SkillCollected += OnGlobalSkillCollected; EventBus.Instance.SkillCollected += OnGlobalSkillCollected;
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
} }
public override void _ExitTree() public override void _ExitTree()
@@ -47,10 +50,21 @@ public partial class Marketplace : Control
{ {
EventBus.Instance.SkillCollected -= OnGlobalSkillCollected; EventBus.Instance.SkillCollected -= OnGlobalSkillCollected;
} }
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
} }
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (@event.IsActionReleased("ui_cancel") && IsVisible())
{
Hide();
foreach (var c in ComponentsToDisable) c.ProcessMode = ProcessModeEnum.Inherit;
GetViewport().SetInputAsHandled();
return;
}
if (!@event.IsActionPressed("show_marketplace")) return; if (!@event.IsActionPressed("show_marketplace")) return;
if (IsVisible()) if (IsVisible())
@@ -62,6 +76,35 @@ public partial class Marketplace : Control
{ {
Show(); Show();
foreach (var c in ComponentsToDisable) c.ProcessMode = ProcessModeEnum.Disabled; foreach (var c in ComponentsToDisable) c.ProcessMode = ProcessModeEnum.Disabled;
if (InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && IsVisible())
GrabFirstFocus();
}
private void GrabFirstFocus()
{
foreach (var btn in _unlockButtons)
{
if (btn.Visible && !btn.Disabled)
{
btn.GrabFocus();
return;
}
}
foreach (var btn in _skillButtons)
{
if (btn.Visible)
{
btn.GrabFocus();
return;
}
} }
} }

View File

@@ -18,6 +18,10 @@ public partial class PauseMenu : Control
public override void _Ready() public override void _Ready()
{ {
ResumeButton.FocusMode = Control.FocusModeEnum.All;
MainMenuButton.FocusMode = Control.FocusModeEnum.All;
QuitButton.FocusMode = Control.FocusModeEnum.All;
SettingsButton.FocusMode = Control.FocusModeEnum.All;
ResumeButton.Pressed += OnResumePressed; ResumeButton.Pressed += OnResumePressed;
MainMenuButton.Pressed += OnMainMenuPressed; MainMenuButton.Pressed += OnMainMenuPressed;
@@ -25,8 +29,34 @@ public partial class PauseMenu : Control
SettingsButton.Pressed += OnSettingsPressed; SettingsButton.Pressed += OnSettingsPressed;
PauseMenuControl.Hide(); PauseMenuControl.Hide();
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
PauseMenuControl.VisibilityChanged += OnVisibilityChanged;
} }
public override void _ExitTree()
{
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
PauseMenuControl.VisibilityChanged -= OnVisibilityChanged;
}
private void OnVisibilityChanged()
{
if (PauseMenuControl.IsVisibleInTree() && InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && PauseMenuControl.IsVisibleInTree())
GrabFirstFocus();
}
private void GrabFirstFocus() => ResumeButton.GrabFocus();
public override void _UnhandledInput(InputEvent @event) public override void _UnhandledInput(InputEvent @event)
{ {
if (!@event.IsActionPressed("pause")) return; if (!@event.IsActionPressed("pause")) return;

View File

@@ -19,6 +19,10 @@ public partial class SettingsMenu : Control
public override void _Ready() public override void _Ready()
{ {
InputSettingsButton.FocusMode = FocusModeEnum.All;
AudioSettingsButton.FocusMode = FocusModeEnum.All;
DisplaySettingsButton.FocusMode = FocusModeEnum.All;
GameplaySettingsButton.FocusMode = FocusModeEnum.All;
InputSettingsButton.Pressed += OnInputSettingsPressed; InputSettingsButton.Pressed += OnInputSettingsPressed;
AudioSettingsButton.Pressed += OnAudioSettingsPressed; AudioSettingsButton.Pressed += OnAudioSettingsPressed;
@@ -29,11 +33,37 @@ public partial class SettingsMenu : Control
AudioSettingsControl?.Hide(); AudioSettingsControl?.Hide();
DisplaySettingsControl?.Hide(); DisplaySettingsControl?.Hide();
GameplaySettingsControl?.Hide(); GameplaySettingsControl?.Hide();
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged += OnDeviceChanged;
VisibilityChanged += OnVisibilityChanged;
} }
public override void _ExitTree()
{
if (InputDeviceManager.Instance != null)
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
VisibilityChanged -= OnVisibilityChanged;
}
private void OnVisibilityChanged()
{
if (IsVisibleInTree() && InputDeviceManager.Instance?.IsPointerless == true)
GrabFirstFocus();
}
private void OnDeviceChanged(int device)
{
var d = (InputDeviceManager.InputDevice)device;
if (d != InputDeviceManager.InputDevice.Mouse && IsVisibleInTree())
GrabFirstFocus();
}
private void GrabFirstFocus() => InputSettingsButton.GrabFocus();
public override void _UnhandledInput(InputEvent @event) public override void _UnhandledInput(InputEvent @event)
{ {
if (!@event.IsActionPressed("ui_cancel")) return; if (!@event.IsActionReleased("ui_cancel")) return;
if (UIManager.IsScreenOnTop(SettingsMenuControl)) UIManager.PopScreen(); if (UIManager.IsScreenOnTop(SettingsMenuControl)) UIManager.PopScreen();
} }

View File

@@ -5,26 +5,16 @@ namespace Mr.BrickAdventures.scripts.components;
[GlobalClass] [GlobalClass]
public partial class DoubleJumpAbility : MovementAbility public partial class DoubleJumpAbility : MovementAbility
{ {
[Export] public float JumpHeight { get; set; } = 100f;
[Export] public float JumpTimeToPeak { get; set; } = 0.5f;
private bool _hasDoubleJumped = false; private bool _hasDoubleJumped = false;
private float _jumpVelocity; private float _jumpVelocity;
public override void Initialize(PlayerController controller) public override void Initialize(PlayerController controller)
{ {
base.Initialize(controller); base.Initialize(controller);
_jumpVelocity = (2.0f * JumpHeight) / JumpTimeToPeak * -1.0f;
foreach (var ability in _controller.GetActiveAbilities())
{
if (ability is VariableJumpAbility jumpAbility)
{
_jumpVelocity = (2.0f * jumpAbility.JumpHeight) / jumpAbility.JumpTimeToPeak * -1.0f;
break;
}
}
if (_jumpVelocity == 0)
{
_jumpVelocity = -400.0f;
}
} }
public override Vector2 ProcessMovement(Vector2 velocity, double delta) public override Vector2 ProcessMovement(Vector2 velocity, double delta)

View File

@@ -5,8 +5,8 @@ namespace Mr.BrickAdventures.scripts.components;
[GlobalClass] [GlobalClass]
public partial class GravityAbility : MovementAbility public partial class GravityAbility : MovementAbility
{ {
public float AscendGravity { get; set; } [Export] public float AscendGravity { get; set; } = 980f;
public float DescendGravity { get; set; } [Export] public float DescendGravity { get; set; } = 1960f;
private float _gravity; private float _gravity;

View File

@@ -26,8 +26,6 @@ public partial class GridMovementAbility : MovementAbility
public override Vector2 ProcessMovement(Vector2 currentVelocity, double delta) public override Vector2 ProcessMovement(Vector2 currentVelocity, double delta)
{ {
GD.Print($"Player position: {_body.Position}, {_body.GlobalPosition}");
var inputDirection = _input.MoveDirection; var inputDirection = _input.MoveDirection;
var newDirection = Vector2.Zero; var newDirection = Vector2.Zero;

View File

@@ -30,8 +30,6 @@ public abstract partial class MovementAbility : Node
SetProcess(false); SetProcess(false);
SetPhysicsProcess(false); SetPhysicsProcess(false);
} }
_body.Velocity = Vector2.Zero;
} }
public abstract Vector2 ProcessMovement(Vector2 currentVelocity, double delta); public abstract Vector2 ProcessMovement(Vector2 currentVelocity, double delta);

View File

@@ -1,4 +1,5 @@
using Godot; using Godot;
using Mr.BrickAdventures.Autoloads;
namespace Mr.BrickAdventures.scripts.components; namespace Mr.BrickAdventures.scripts.components;
@@ -13,9 +14,13 @@ public partial class PlayerInputHandler : Node
public bool DownReleased { get; private set; } public bool DownReleased { get; private set; }
public bool DownHeld { get; private set; } public bool DownHeld { get; private set; }
public override void _Process(double delta) public override void _PhysicsProcess(double delta)
{ {
MoveDirection = Input.GetVector("left", "right", "up", "down"); var rawInput = Input.GetVector("left", "right", "up", "down");
var sensitivity = SettingsManager.Instance?.GamepadSensitivity ?? 1.0f;
MoveDirection = rawInput.Length() > 0
? rawInput.Normalized() * Mathf.Min(rawInput.Length() * sensitivity, 1.0f)
: Vector2.Zero;
JumpPressed = Input.IsActionJustPressed("jump"); JumpPressed = Input.IsActionJustPressed("jump");
JumpReleased = Input.IsActionJustReleased("jump"); JumpReleased = Input.IsActionJustReleased("jump");

View File

@@ -7,19 +7,26 @@ public partial class WallJumpAbility : MovementAbility
{ {
[ExportGroup("Wall Jump Design")] [ExportGroup("Wall Jump Design")]
[Export] public Vector2 WallJumpVelocity { get; set; } = new(500.0f, -350.0f); [Export] public Vector2 WallJumpVelocity { get; set; } = new(500.0f, -350.0f);
[ExportGroup("Wall Slide Feel")] [ExportGroup("Wall Slide Feel")]
[Export(PropertyHint.Range, "0.0, 1.0, 0.05")] public float WallSlideGravityMultiplier { get; set; } = 0.7f; [Export(PropertyHint.Range, "0.0, 1.0, 0.05")] public float WallSlideGravityMultiplier { get; set; } = 0.7f;
[Export] public float MaxWallSlideSpeed { get; set; } = 150.0f; [Export] public float MaxWallSlideSpeed { get; set; } = 150.0f;
private float _gravity;
public override void Initialize(PlayerController controller)
{
base.Initialize(controller);
_gravity = (float)ProjectSettings.GetSetting("physics/2d/default_gravity");
}
public override Vector2 ProcessMovement(Vector2 velocity, double delta) public override Vector2 ProcessMovement(Vector2 velocity, double delta)
{ {
var isOnWall = _body.IsOnWall(); var isOnWall = _body.IsOnWall();
if (isOnWall && !_body.IsOnFloor() && velocity.Y > 0f) if (isOnWall && !_body.IsOnFloor() && velocity.Y > 0f)
{ {
var gravity = (float)ProjectSettings.GetSetting("physics/2d/default_gravity"); var newYVelocity = velocity.Y + _gravity * WallSlideGravityMultiplier * (float)delta;
var newYVelocity = velocity.Y + gravity * WallSlideGravityMultiplier * (float)delta;
velocity.Y = Mathf.Min(newYVelocity, MaxWallSlideSpeed); velocity.Y = Mathf.Min(newYVelocity, MaxWallSlideSpeed);
} }

View File

@@ -1,8 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Godot; using Godot;
using Mr.BrickAdventures.Autoloads; using Mr.BrickAdventures.Autoloads;
using Mr.BrickAdventures.scripts.Resources;
namespace Mr.BrickAdventures.scripts.components; namespace Mr.BrickAdventures.scripts.components;
@@ -10,15 +9,7 @@ namespace Mr.BrickAdventures.scripts.components;
public partial class PlayerController : CharacterBody2D public partial class PlayerController : CharacterBody2D
{ {
[Export] private Node MovementAbilitiesContainer { get; set; } [Export] private Node MovementAbilitiesContainer { get; set; }
[Export] public MovementPreset DefaultPreset { get; set; }
[ExportGroup("Movement Ability Scenes")]
[Export] public PackedScene GroundMovementScene { get; set; }
[Export] public PackedScene JumpMovementScene { get; set; }
[Export] public PackedScene GravityScene { get; set; }
[Export] public PackedScene OneWayPlatformScene { get; set; }
[Export] public PackedScene SpaceshipMovementScene { get; set; }
[Export] public PackedScene WallJumpScene { get; set; }
[Export] public PackedScene GridMovementScene { get; set; }
[Signal] public delegate void JumpInitiatedEventHandler(); [Signal] public delegate void JumpInitiatedEventHandler();
[Signal] public delegate void MovementAbilitiesChangedEventHandler(); [Signal] public delegate void MovementAbilitiesChangedEventHandler();
@@ -48,16 +39,10 @@ public partial class PlayerController : CharacterBody2D
} }
_inputHandler = GetNode<PlayerInputHandler>("PlayerInputHandler"); _inputHandler = GetNode<PlayerInputHandler>("PlayerInputHandler");
foreach (var child in MovementAbilitiesContainer.GetChildren())
{
if (child is MovementAbility ability)
{
ability.Initialize(this);
_abilities.Add(ability);
}
}
_ = ConnectJumpAndGravityAbilities(); if (DefaultPreset != null)
ApplyPreset(DefaultPreset);
EmitSignalMovementAbilitiesChanged(); EmitSignalMovementAbilitiesChanged();
EventBus.EmitPlayerSpawned(this); EventBus.EmitPlayerSpawned(this);
} }
@@ -81,6 +66,19 @@ public partial class PlayerController : CharacterBody2D
MoveAndSlide(); MoveAndSlide();
} }
public void ApplyPreset(MovementPreset preset)
{
if (preset == null) return;
ClearMovementAbilities();
Velocity = Vector2.Zero;
foreach (var scene in preset.Abilities)
{
if (scene != null)
AddAbility(scene.Instantiate<MovementAbility>());
}
EmitSignalMovementAbilitiesChanged();
}
public void AddAbility(MovementAbility ability) public void AddAbility(MovementAbility ability)
{ {
MovementAbilitiesContainer.AddChild(ability); MovementAbilitiesContainer.AddChild(ability);
@@ -110,46 +108,4 @@ public partial class PlayerController : CharacterBody2D
} }
} }
} }
}
public void SetPlatformMovement()
{
ClearMovementAbilities();
if (GroundMovementScene != null) AddAbility(GroundMovementScene.Instantiate<MovementAbility>());
if (JumpMovementScene != null) AddAbility(JumpMovementScene.Instantiate<MovementAbility>());
if (GravityScene != null) AddAbility(GravityScene.Instantiate<MovementAbility>());
if (OneWayPlatformScene != null) AddAbility(OneWayPlatformScene.Instantiate<MovementAbility>());
_ = ConnectJumpAndGravityAbilities();
EmitSignalMovementAbilitiesChanged();
}
public void SetSpaceshipMovement()
{
ClearMovementAbilities();
if (SpaceshipMovementScene != null) AddAbility(SpaceshipMovementScene.Instantiate<MovementAbility>());
EmitSignalMovementAbilitiesChanged();
}
public void SetGridMovement()
{
ClearMovementAbilities();
if (GridMovementScene != null) AddAbility(GridMovementScene.Instantiate<MovementAbility>());
EmitSignalMovementAbilitiesChanged();
}
private async Task ConnectJumpAndGravityAbilities()
{
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
var jumpAbility = _abilities.OfType<VariableJumpAbility>().FirstOrDefault();
var gravityAbility = _abilities.OfType<GravityAbility>().FirstOrDefault();
if (jumpAbility != null && gravityAbility != null)
{
gravityAbility.AscendGravity = jumpAbility.AscendGravity;
gravityAbility.DescendGravity = jumpAbility.DescendGravity;
}
}
}

View File

@@ -1,10 +1,12 @@
using Godot; using Godot;
using Mr.BrickAdventures.scripts.Resources;
namespace Mr.BrickAdventures.scripts.components; namespace Mr.BrickAdventures.scripts.components;
[GlobalClass] [GlobalClass]
public partial class SpaceshipEnterComponent : Area2D public partial class SpaceshipEnterComponent : Area2D
{ {
[Export] public MovementPreset Preset { get; set; }
[Signal] public delegate void SpaceshipEnteredEventHandler(); [Signal] public delegate void SpaceshipEnteredEventHandler();
public override void _Ready() public override void _Ready()
@@ -15,7 +17,7 @@ public partial class SpaceshipEnterComponent : Area2D
private void OnBodyEntered(Node2D body) private void OnBodyEntered(Node2D body)
{ {
if (body is not PlayerController player) return; if (body is not PlayerController player) return;
player.SetSpaceshipMovement(); player.ApplyPreset(Preset);
EmitSignalSpaceshipEntered(); EmitSignalSpaceshipEntered();
QueueFree(); QueueFree();
} }

View File

@@ -1,12 +1,14 @@
using Godot; using Godot;
using Mr.BrickAdventures.scripts.Resources;
namespace Mr.BrickAdventures.scripts.components; namespace Mr.BrickAdventures.scripts.components;
[GlobalClass] [GlobalClass]
public partial class SpaceshipExitComponent : Area2D public partial class SpaceshipExitComponent : Area2D
{ {
[Export] public MovementPreset Preset { get; set; }
[Signal] public delegate void SpaceshipExitEventHandler(); [Signal] public delegate void SpaceshipExitEventHandler();
public override void _Ready() public override void _Ready()
{ {
BodyEntered += OnBodyEntered; BodyEntered += OnBodyEntered;
@@ -16,6 +18,6 @@ public partial class SpaceshipExitComponent : Area2D
{ {
if (body is not PlayerController player) return; if (body is not PlayerController player) return;
EmitSignalSpaceshipExit(); EmitSignalSpaceshipExit();
player.SetPlatformMovement(); player.ApplyPreset(Preset);
} }
} }