tested some platforming mechanics
This commit is contained in:
parent
944399ac53
commit
26c0c2c9a7
3 changed files with 15 additions and 12 deletions
|
|
@ -76,7 +76,7 @@ attack={
|
||||||
}
|
}
|
||||||
dash={
|
dash={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
|
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"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":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"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":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -51,7 +51,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
public float DashSpeed { get; set; } = 400.0f;
|
public float DashSpeed { get; set; } = 400.0f;
|
||||||
|
|
||||||
[Export(PropertyHint.None, "suffix:s")]
|
[Export(PropertyHint.None, "suffix:s")]
|
||||||
public float DashCooldownDuration { get; set; } = 0.4f;
|
public float DashCooldownDuration { get; set; } = 0.6f;
|
||||||
|
|
||||||
/// <summary>The angle difference from perfect left/right that still counts.</summary>
|
/// <summary>The angle difference from perfect left/right that still counts.</summary>
|
||||||
[Export(PropertyHint.Range, "0,360,0.1,radians_as_degrees")]
|
[Export(PropertyHint.Range, "0,360,0.1,radians_as_degrees")]
|
||||||
|
|
@ -140,6 +140,8 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
|
|
||||||
if (CanTurn) AdjustFacing();
|
if (CanTurn) AdjustFacing();
|
||||||
|
|
||||||
|
if (DashTicker.HasFinishedLastTick) velocity *= 0.6f;
|
||||||
|
|
||||||
if (DashTicker.IsRunning)
|
if (DashTicker.IsRunning)
|
||||||
{
|
{
|
||||||
velocity = DashDirection * DashSpeed;
|
velocity = DashDirection * DashSpeed;
|
||||||
|
|
@ -223,7 +225,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
WaterJumpAllowedTicker.Tick(deltaF);
|
WaterJumpAllowedTicker.Tick(deltaF);
|
||||||
DashTicker.Tick(deltaF);
|
DashTicker.Tick(deltaF);
|
||||||
DashCooldown.Tick(deltaF);
|
DashCooldown.Tick(deltaF);
|
||||||
if (IsInWater) DashPoints = Mathf.Min(MaxDashPoints, DashPoints + 1f * deltaF);
|
if (IsInWater) DashPoints = Mathf.Min(MaxDashPoints, DashPoints + 3f * deltaF);
|
||||||
|
|
||||||
if (IsOnCeiling()) JumpTicker.Reset();
|
if (IsOnCeiling()) JumpTicker.Reset();
|
||||||
}
|
}
|
||||||
|
|
@ -315,8 +317,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
|
|
||||||
case { Action: Action.Jump, IsPressed: true }
|
case { Action: Action.Jump, IsPressed: true }
|
||||||
when JumpAllowedTicker.IsRunning
|
when JumpAllowedTicker.IsRunning
|
||||||
&& (!IsOnFloor() || input.Direction.Y <= 0)
|
&& (!IsOnFloor() || input.Direction.Y <= 0):
|
||||||
&& !IsInWater:
|
|
||||||
GroundJump();
|
GroundJump();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -366,8 +367,10 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
{
|
{
|
||||||
AdjustFacing();
|
AdjustFacing();
|
||||||
JumpAllowedTicker.Reset();
|
JumpAllowedTicker.Reset();
|
||||||
Velocity += GetWallNormal() * 200.0f;
|
JumpTicker.Duration = JumpAscentMaxDuration;
|
||||||
Velocity = Velocity with { Y = Mathf.Min(0, Velocity.Y) };
|
JumpTicker.Start();
|
||||||
|
var direction = new Vector2(Mathf.Sign(GetWallNormal().X), -.5f).Normalized();
|
||||||
|
Velocity = direction * 200.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void JumpCut()
|
private void JumpCut()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue