removed ability to scale up wall by mashing dash and jump buttons
This commit is contained in:
@@ -134,7 +134,7 @@ SimpleJumpHangTimeInFrames = 1
|
||||
SimpleJumpGravityLesseningFactor = 2.0
|
||||
DoubleJumpHangTimeInFrames = 3
|
||||
DoubleJumpGravityLesseningFactor = 1.5
|
||||
WallJumpStartVelocity = 8.0
|
||||
WallJumpStartVelocity = 12.0
|
||||
MaxNumberOfEmpoweredActions = 3
|
||||
SimpleDashStrength = 18.0
|
||||
SimpleDashTime = 0.2
|
||||
@@ -155,7 +155,9 @@ WallHugGravityLesseningFactor = 15.0
|
||||
WallHugDownwardMaxSpeed = 4.0
|
||||
WallHugHorizontalDeceleration = 1.0
|
||||
WallRunUpwardVelocityFactor = 0.5
|
||||
MinimumWallRunUpwardVelocity = 3.0
|
||||
MinimumWallRunUpwardSpeed = 4.0
|
||||
WallRunAltitudeLossSpeed = 8.0
|
||||
WallRunSpeedThreshold = 7.0
|
||||
|
||||
[node name="CHealth" parent="." unique_id=1244478698 instance=ExtResource("3_q7bng")]
|
||||
RHealth = ExtResource("4_m8gvy")
|
||||
@@ -391,7 +393,6 @@ wait_time = 0.8
|
||||
one_shot = true
|
||||
|
||||
[node name="AirborneDashCooldown" type="Timer" parent="." unique_id=976335884]
|
||||
wait_time = 0.5
|
||||
one_shot = true
|
||||
|
||||
[node name="PowerCooldown" type="Timer" parent="." unique_id=1091679675]
|
||||
@@ -408,7 +409,6 @@ offset_left = 1524.0
|
||||
offset_top = 1.0
|
||||
offset_right = -8.0
|
||||
offset_bottom = 1.0
|
||||
enabled = false
|
||||
initial_node_to_watch = NodePath("../StateChart")
|
||||
|
||||
[node name="UI" type="Control" parent="." unique_id=856532641]
|
||||
|
||||
@@ -240,10 +240,11 @@ public partial class PlayerController : CharacterBody3D,
|
||||
[Export(PropertyHint.Range, "0,2,0.01,or_greater")]
|
||||
public float WallRunUpwardVelocityFactor { get; set; } = 0.05f;
|
||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||
public float MinimumWallRunUpwardVelocity { get; set; } = 2f;
|
||||
public float MinimumWallRunUpwardSpeed { get; set; } = 2f;
|
||||
[Export(PropertyHint.Range, "0,30,0.1,or_greater")]
|
||||
public float MinimumWallRunHorizontalSpeed { get; set; } = 12f;
|
||||
[Export(PropertyHint.Range, "1,20,0.1,or_greater")]
|
||||
public float WallRunAltitudeLossSpeed { get; set; } = 10f;
|
||||
|
||||
[Export(PropertyHint.Range, "1,20,0.1,or_greater")]
|
||||
public float WallRunSpeedThreshold { get; set; } = 8f;
|
||||
|
||||
@@ -617,6 +618,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_onWall.StateExited += OnWallStopped;
|
||||
_onWallHugging.StatePhysicsProcessing += HandleWallHugging;
|
||||
_onWallHanging.StatePhysicsProcessing += HandleWallHanging;
|
||||
_onWallRunning.StateEntered += OnWallRunStarted;
|
||||
_onWallRunning.StatePhysicsProcessing += HandleWallRunning;
|
||||
|
||||
_onWallHanging.StateExited += RecoverWeapon;
|
||||
@@ -725,6 +727,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_bufferedAction = BufferedActions.None;
|
||||
return;
|
||||
}
|
||||
|
||||
_canDash = true;
|
||||
_canDashAirborne = true;
|
||||
_playerState.SendEvent("dash");
|
||||
}
|
||||
|
||||
@@ -733,16 +738,18 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_currentInputBufferFrames = 0;
|
||||
_playerState.SendEvent("jump");
|
||||
}
|
||||
if (_bufferedAction == BufferedActions.Dash && _currentInputBufferFrames > 0)
|
||||
{
|
||||
if (GetMoveInput().Length() < Mathf.Epsilon)
|
||||
{
|
||||
_bufferedAction = BufferedActions.None;
|
||||
return;
|
||||
}
|
||||
_currentInputBufferFrames = 0;
|
||||
_playerState.SendEvent("dash");
|
||||
}
|
||||
// if (_bufferedAction == BufferedActions.Dash && _currentInputBufferFrames > 0)
|
||||
// {
|
||||
// if (GetMoveInput().Length() < Mathf.Epsilon)
|
||||
// {
|
||||
// _bufferedAction = BufferedActions.None;
|
||||
// return;
|
||||
// }
|
||||
// // _canDash = true;
|
||||
// // _canDashAirborne = true;
|
||||
// _currentInputBufferFrames = 0;
|
||||
// _playerState.SendEvent("dash");
|
||||
// }
|
||||
}
|
||||
|
||||
public void OnAirborneToGrounded()
|
||||
@@ -866,7 +873,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
// Should we start a wall run
|
||||
if (ShouldStartWallRun())
|
||||
{
|
||||
SetVerticalVelocity(GetWallRunStartVerticalVelocity());
|
||||
_playerState.SendEvent("wall_run");
|
||||
return;
|
||||
}
|
||||
@@ -1100,8 +1106,14 @@ public partial class PlayerController : CharacterBody3D,
|
||||
if (!_canDashAirborne)
|
||||
return;
|
||||
_canDashAirborne = false;
|
||||
_airborneDashCooldownTimer.Start();
|
||||
_playerState.SendEvent("dash");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!_canDash) return;
|
||||
_canDash = false;
|
||||
_simpleDashCooldownTimer.Start();
|
||||
_playerState.SendEvent("dash");
|
||||
}
|
||||
public void SimpleDashInDirection(Vector3 direction, float strength = -1)
|
||||
@@ -1126,13 +1138,13 @@ public partial class PlayerController : CharacterBody3D,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_canDash)
|
||||
{
|
||||
var dashEvent = isOnFloorCustom() ? "grounded" : "dash_finished";
|
||||
_playerState.SendEvent(dashEvent);
|
||||
return;
|
||||
}
|
||||
_canDash = false;
|
||||
// if (!_canDash)
|
||||
// {
|
||||
// var dashEvent = isOnFloorCustom() ? "grounded" : "dash_finished";
|
||||
// _playerState.SendEvent(dashEvent);
|
||||
// return;
|
||||
// }
|
||||
// _canDash = false;
|
||||
SimpleDash();
|
||||
_bufferedAction = BufferedActions.None;
|
||||
}
|
||||
@@ -1175,6 +1187,11 @@ public partial class PlayerController : CharacterBody3D,
|
||||
}
|
||||
public void OnWallStarted()
|
||||
{
|
||||
if (_simpleDashCooldownTimer.IsStopped())
|
||||
_canDash = true;
|
||||
else
|
||||
_simpleDashCooldownTimer.Start();
|
||||
|
||||
if (!WallHugSystem.IsWallHugging())
|
||||
return;
|
||||
|
||||
@@ -1192,14 +1209,12 @@ public partial class PlayerController : CharacterBody3D,
|
||||
}
|
||||
public void HandleWallHugging(float delta)
|
||||
{
|
||||
_canDash = true;
|
||||
_canDashAirborne = true;
|
||||
// _canDash = true;
|
||||
// _canDashAirborne = true;
|
||||
|
||||
WallHug(delta);
|
||||
if (ShouldStartWallRun())
|
||||
{
|
||||
var verticalVelocity = GetWallRunStartVerticalVelocity();
|
||||
SetVerticalVelocity(verticalVelocity);
|
||||
_playerState.SendEvent("wall_run");
|
||||
return;
|
||||
}
|
||||
@@ -1212,6 +1227,17 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
WallHang(delta);
|
||||
}
|
||||
|
||||
public void OnWallRunStarted()
|
||||
{
|
||||
// Find horizontal velocity projected on the current wall
|
||||
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
||||
var hvelProjected = hvel.Slide(_wallHugStartNormal);
|
||||
var hSpeed = Mathf.Max(hvel.Length(), MinimumWallRunHorizontalSpeed);
|
||||
// Reorient horizontal velocity so we keep it coplanar with the wall without losing speed
|
||||
var finalHVel = hvelProjected.Normalized() * hSpeed;
|
||||
Velocity = finalHVel + Vector3.Up*GetWallRunStartVerticalVelocity();
|
||||
}
|
||||
public void HandleWallRunning(float delta)
|
||||
{
|
||||
// _canDash = false;
|
||||
@@ -1243,7 +1269,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
||||
var hvelProjected = hvel.Slide(_wallHugStartNormal);
|
||||
return Mathf.Max(hvelProjected.Length() * WallRunUpwardVelocityFactor, MinimumWallRunUpwardVelocity);
|
||||
return Mathf.Max(hvelProjected.Length() * WallRunUpwardVelocityFactor, MinimumWallRunUpwardSpeed);
|
||||
}
|
||||
|
||||
public bool ShouldStartWallRun()
|
||||
@@ -1256,7 +1282,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
var isCoplanarEnough = Velocity.AngleTo(wallNormal) > Math.PI/4 && Velocity.AngleTo(wallNormal) < 3*Math.PI/4;
|
||||
var isGoingDownwards = Velocity.AngleTo(Vector3.Down) < Math.PI/4;
|
||||
var isLookingInDirectionOfRun = hvelProjected.AngleTo(-HeadSystem.GetForwardHorizontalVector()) < Math.PI/2;
|
||||
var shouldStart = haveEnoughSpeed && isCoplanarEnough && !isGoingDownwards && isIndeedWall && isLookingInDirectionOfRun;
|
||||
var shouldStart = haveEnoughSpeed && !isGoingDownwards && isIndeedWall && isCoplanarEnough && isLookingInDirectionOfRun;
|
||||
|
||||
var debugText = "--------------\n";
|
||||
debugText += shouldStart ? "WALL RUN STARTED\n" : "NO WALL RUN\n";
|
||||
@@ -1371,12 +1397,11 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
||||
|
||||
// if (ShouldStartWallRun() && Velocity.Y < WallRunUpwardVelocity)
|
||||
// {
|
||||
// SetVerticalVelocity(WallRunUpwardVelocity);
|
||||
// _playerState.SendEvent("wall_run");
|
||||
// return;
|
||||
// }
|
||||
if (ShouldStartWallRun() && !_isJumpInputPressed)
|
||||
{
|
||||
_playerState.SendEvent("wall_run");
|
||||
return;
|
||||
}
|
||||
|
||||
// Update horizontal velocity
|
||||
var horizontalVelocity = ComputeHVelocityAir(delta);
|
||||
@@ -1434,8 +1459,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
ComputeJumpFromWallHSpeed(WallJumpStartVelocity);
|
||||
}
|
||||
|
||||
// Remove the ability to dash straight away so you cannot scale up the wall
|
||||
_canDashAirborne = false;
|
||||
// _canDashAirborne = false;
|
||||
_airborneDashCooldownTimer.Start();
|
||||
_isWallJumpAvailable = false;
|
||||
}
|
||||
@@ -1768,6 +1794,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public void PerformEmpoweredAction()
|
||||
{
|
||||
_isWallJumpAvailable = true;
|
||||
_canDashAirborne = true;
|
||||
EmpoweredActionsLeft--;
|
||||
_playerState.SendEvent(EmpoweredActionsLeft <= 0 ? "expired" : "power_used");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user