diff --git a/Dancer.csproj b/Dancer.csproj index ed25556..7787bda 100644 --- a/Dancer.csproj +++ b/Dancer.csproj @@ -1,4 +1,4 @@ - + net10.0 true diff --git a/project.godot b/project.godot index 41c8821..95bb4e6 100644 --- a/project.godot +++ b/project.godot @@ -80,6 +80,12 @@ dash={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +parry={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null) +] +} [layer_names] diff --git a/src/Util.cs.uid b/src/Util.cs.uid new file mode 100644 index 0000000..dabd3f2 --- /dev/null +++ b/src/Util.cs.uid @@ -0,0 +1 @@ +uid://bhl0mh0d7oh4 diff --git a/src/player/Player.cs b/src/player/Player.cs index bfa0145..3cb268e 100644 --- a/src/player/Player.cs +++ b/src/player/Player.cs @@ -88,6 +88,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, private Ticker JumpTicker { get; } = new(); private Vector2 DashDirection { get; set; } public float DashPoints { get; set; } + public float BankedDashPoints { get; set; } private Ticker GlobalDamageImmunityTicker { get; } = new(); [Node] private AnimationTree AnimationTree { get; set; } = null!; @@ -97,6 +98,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, public void OnReady() { this.Provide(); + SetProcess(true); SetPhysicsProcess(true); Health = MaxHealth; _playback = AnimationTree.Get("parameters/playback").As(); @@ -241,11 +243,11 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, var collisionPos = collision.GetPosition() + collision.GetTravel(); var mapCoords = tileMapLayer.GlobalToMap(collisionPos); - if (tileMapLayer.GetCellTileData(mapCoords) is not { } tileData - || !tileData.HasCustomData("damage")) + if (tileMapLayer.GetCellTileData(mapCoords) is not { } tileData) continue; - if (tileData.GetCustomData("damage") is not { VariantType: Variant.Type.Float } variant) + if (!tileData.HasCustomData("damage") + || tileData.GetCustomData("damage") is not { VariantType: Variant.Type.Float } variant) continue; if (variant.AsSingle() is > 0f and var damage) @@ -259,7 +261,16 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, WaterJumpAllowedTicker.Tick(deltaF); DashTicker.Tick(deltaF); DashCooldown.Tick(deltaF); - if (IsInWater) DashPoints = Mathf.Min(MaxDashPoints, DashPoints + 3f * deltaF); + { + var addedDashPoints = 3f * deltaF; + if (IsInWater) + { + DashPoints += BankedDashPoints; + BankedDashPoints = 0; + DashPoints = Mathf.Min(MaxDashPoints, DashPoints + addedDashPoints); + } + else BankedDashPoints = Mathf.Min(1, BankedDashPoints + 3f * addedDashPoints); + } GlobalDamageImmunityTicker.Tick(deltaF); if (IsOnCeiling()) JumpTicker.Reset(); @@ -293,7 +304,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, && _currentDirection.X != 0; } - public override void _Process(double delta) + public void OnProcess(double delta) { GetNode("%Body").Scale = new(IsFacingRight ? 1 : -1, 1); } diff --git a/src/player/player.aseprite b/src/player/player.aseprite index 2190ce3..1b82fb0 100644 --- a/src/player/player.aseprite +++ b/src/player/player.aseprite @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b4252b5d9c0af105bc74fa2827ff9488115eca4e76bc49143718c17bf81d700 -size 6855 +oid sha256:a7223b9349905f79aa685ffd6c5c43cf2355349e1ac46b5fa8a533c9ca3958e4 +size 6801