sprite trails!
This commit is contained in:
parent
ee8cbaa1dc
commit
b8d06ff5c3
5 changed files with 182 additions and 32 deletions
|
|
@ -21,13 +21,13 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
public float GroundedSpeedStopDecay { get; set; } = 0.005f;
|
||||
|
||||
[Export(PropertyHint.None, "suffix:px/s")]
|
||||
public float WalkMaxSpeed { get; set; } = 150.0f;
|
||||
public float WalkMaxSpeed { get; set; } = 140.0f;
|
||||
|
||||
[Export(PropertyHint.None, "suffix:px/s")]
|
||||
public float AirMaxSpeed { get; set; } = 150.0f;
|
||||
public float AirMaxSpeed { get; set; } = 140.0f;
|
||||
|
||||
[Export(PropertyHint.None, "suffix:px/s")]
|
||||
public float WaterMaxSpeed { get; set; } = 190.0f;
|
||||
public float WaterMaxSpeed { get; set; } = 220.0f;
|
||||
|
||||
[Export(PropertyHint.None, "suffix:px/s²")]
|
||||
public float WalkAccel { get; set; } = 800.0f;
|
||||
|
|
@ -39,13 +39,13 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
public float WaterAccel { get; set; } = 1200.0f;
|
||||
|
||||
[Export(PropertyHint.None, "suffix:px/s")]
|
||||
public float JumpAscentSpeed { get; set; } = 200.0f;
|
||||
public float JumpAscentSpeed { get; set; } = 190.0f;
|
||||
|
||||
[Export(PropertyHint.None, "suffix:px/s")]
|
||||
public float SlashSpeedBoost { get; set; } = 90.0f;
|
||||
|
||||
[Export(PropertyHint.None, "suffix:px/s")]
|
||||
public float DashSpeed { get; set; } = 400.0f;
|
||||
public float DashSpeed { get; set; } = 800.0f;
|
||||
|
||||
/// <summary>The angle difference from perfect left/right that still counts.</summary>
|
||||
[Export(PropertyHint.Range, "0,360,0.1,radians_as_degrees")]
|
||||
|
|
@ -96,6 +96,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
[Node] private Timer GlobalDamageImmunityTimer { get; set; } = null!;
|
||||
[Node] private Timer PlatformIgnoreTimer { get; set; } = null!;
|
||||
[Node] private Timer ParryTimer { get; set; } = null!;
|
||||
[Node] private SpriteTrail SpriteTrail { get; set; } = null!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
|
|
@ -167,7 +168,9 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
{
|
||||
if (!DashDirectionChangeTimer.IsStopped())
|
||||
{
|
||||
DashDirection = _currentDirection;
|
||||
DashDirection = _currentDirection.IsZeroApprox()
|
||||
? FacingVector
|
||||
: _currentDirection.Normalized();
|
||||
}
|
||||
|
||||
velocity = DashDirection * DashSpeed;
|
||||
|
|
@ -182,18 +185,17 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
inputDirection.Y = -1f;
|
||||
}
|
||||
|
||||
velocity += inputDirection.Normalized() * WaterAccel * deltaF;
|
||||
if (!velocityWasTooLarge || velocity.Dot(inputDirection) < 0f)
|
||||
{
|
||||
velocity += inputDirection.Normalized() * WaterAccel * deltaF;
|
||||
}
|
||||
|
||||
var velocityIsTooLarge = velocity.Length() > WaterMaxSpeed;
|
||||
if (velocityWasTooLarge && velocityIsTooLarge)
|
||||
{
|
||||
dragAmount = 0.015f;
|
||||
}
|
||||
|
||||
if (!velocityWasTooLarge && velocityIsTooLarge)
|
||||
{
|
||||
velocity = velocity.LimitLength(WaterMaxSpeed);
|
||||
}
|
||||
|
||||
if (!velocityIsTooLarge && inputDirection.IsZeroApprox())
|
||||
{
|
||||
dragAmount = 0.1f;
|
||||
|
|
@ -365,8 +367,10 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
AnimationTree.Set("parameters/holding_wall/blend_amount", IsHoldingWall ? 1f : 0f);
|
||||
AnimationTree.Set("parameters/ground/blend_position", Mathf.Abs(Velocity.X));
|
||||
AnimationTree.Set("parameters/air/blend_position", Velocity.Y);
|
||||
AnimationTree.Set("parameters/dive/blend_position", new Vector2(Mathf.Abs(Velocity.X), Velocity.Y));
|
||||
AnimationTree.Set("parameters/dash_sm/dash/blend_position", new Vector2(Mathf.Abs(Velocity.X), Velocity.Y));
|
||||
AnimationTree.Set("parameters/dive/blend_position",
|
||||
new Vector2(Mathf.Abs(Velocity.X), Velocity.Y));
|
||||
AnimationTree.Set("parameters/dash_sm/dash/blend_position",
|
||||
new Vector2(Mathf.Abs(Velocity.X), Velocity.Y));
|
||||
}
|
||||
|
||||
public readonly struct BufferedInput
|
||||
|
|
@ -535,16 +539,21 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
DashTimer.Start();
|
||||
DashDirectionChangeTimer.Start();
|
||||
DashCooldownTimer.Start();
|
||||
CreateTween()
|
||||
.TweenProperty(Engine.Singleton, "time_scale", 1.0f, 0.05f)
|
||||
.From(0.01)
|
||||
.SetEase(Tween.EaseType.InOut);
|
||||
DashDirection = (_currentDirection.IsZeroApprox()
|
||||
? FacingVector
|
||||
: _currentDirection
|
||||
).Normalized();
|
||||
DashHitbox.StartAttack();
|
||||
AnimationTree.Set("parameters/dash/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
|
||||
|
||||
Engine.Singleton.TimeScale = 0.1f;
|
||||
SpriteTrail.CreateAfterImages = true;
|
||||
|
||||
var tween = CreateTween().SetEase(Tween.EaseType.InOut);
|
||||
tween.TweenProperty(Engine.Singleton, "time_scale", 0.2f, 0.02);
|
||||
tween.TweenProperty(Engine.Singleton, "time_scale", 0.5f, 0.01);
|
||||
tween.TweenProperty(Engine.Singleton, "time_scale", 1.0f, 0.01).SetDelay(0.07);
|
||||
tween.TweenCallback(Callable.From(() => SpriteTrail.CreateAfterImages = false)).SetDelay(0.05);
|
||||
}
|
||||
|
||||
private void Parry() => ParryTimer.Start();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue