small gravity and jump balancing, removed wall jumping coyote times
This commit is contained in:
@@ -63,16 +63,15 @@ blend_mode = 1
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_poq2x")
|
||||
WalkSpeed = 7.5
|
||||
AccelerationAir = 2.0
|
||||
DecelerationAir = 0.1
|
||||
Weight = 5.0
|
||||
MantleTime = 0.2
|
||||
AccelerationAir = 0.8
|
||||
DecelerationAir = 0.02
|
||||
Weight = 4.0
|
||||
MantleTime = 0.3
|
||||
MantlePath = ExtResource("2_6lejt")
|
||||
CoyoteTime = 0.3
|
||||
SimpleJumpStartVelocity = 8.0
|
||||
SimpleJumpStartVelocity = 6.0
|
||||
SimpleJumpHangTimeInFrames = 1
|
||||
SimpleJumpGravityLesseningFactor = 2.5
|
||||
DoubleJumpStartVelocity = 15.0
|
||||
SimpleJumpGravityLesseningFactor = 2.0
|
||||
DoubleJumpHangTimeInFrames = 3
|
||||
DoubleJumpGravityLesseningFactor = 1.5
|
||||
MegaJumpStartVelocity = 30.0
|
||||
@@ -236,6 +235,11 @@ transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0
|
||||
mesh = SubResource("CylinderMesh_nodcl")
|
||||
|
||||
[node name="DashCooldown" type="Timer" parent="."]
|
||||
wait_time = 0.8
|
||||
one_shot = true
|
||||
|
||||
[node name="AirborneDashCooldown" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
one_shot = true
|
||||
|
||||
[node name="PowerCooldown" type="Timer" parent="."]
|
||||
@@ -252,6 +256,7 @@ 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="."]
|
||||
@@ -608,7 +613,7 @@ default_state = NodePath("../CoyoteEnabled")
|
||||
|
||||
[node name="OnWallRun" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../OnWall/RunningCoyoteEnabled")
|
||||
to = NodePath("../../OnWall/Running")
|
||||
event = &"wall_run"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
@@ -671,7 +676,7 @@ script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../OnWall/HuggingCoyoteEnabled")
|
||||
to = NodePath("../../../OnWall/Hugging")
|
||||
event = &"wall_hug"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
@@ -735,7 +740,7 @@ script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Jump/SimpleJump")
|
||||
to = NodePath("../../../Jump/DoubleJump")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
@@ -744,7 +749,7 @@ script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hanging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Jump/SimpleJump")
|
||||
to = NodePath("../../../Jump/DoubleJump")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
// Timers
|
||||
private Timer _timeScaleAimInAirTimer;
|
||||
private Timer _simpleDashCooldownTimer;
|
||||
private Timer _airborneDashCooldownTimer;
|
||||
private Timer _powerCooldownTimer;
|
||||
|
||||
[Export] public Marker3D TutorialWeaponTarget;
|
||||
@@ -327,6 +328,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
_powerCooldownTimer = GetNode<Timer>("PowerCooldown");
|
||||
_timeScaleAimInAirTimer = GetNode<Timer>("TimeScaleAimInAir");
|
||||
_simpleDashCooldownTimer = GetNode<Timer>("DashCooldown");
|
||||
_airborneDashCooldownTimer = GetNode<Timer>("AirborneDashCooldown");
|
||||
|
||||
///////////////////////////
|
||||
// Initialize components //
|
||||
@@ -398,6 +400,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
_aimedDash.StateExited += OnAimedDashFinished;
|
||||
|
||||
_simpleDashCooldownTimer.Timeout += DashCooldownTimeout;
|
||||
_airborneDashCooldownTimer.Timeout += AirborneDashCooldownTimeout;
|
||||
|
||||
_onWall.StateEntered += OnWallStarted;
|
||||
_onWall.StateExited += OnWallStopped;
|
||||
@@ -469,10 +472,19 @@ public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
_canDash = true;
|
||||
}
|
||||
public void AirborneDashCooldownTimeout()
|
||||
{
|
||||
_canDashAirborne = true;
|
||||
}
|
||||
|
||||
public bool IsPlayerInputtingForward()
|
||||
{
|
||||
return GetMoveInput().Z < -0.5f;
|
||||
}
|
||||
|
||||
public bool IsTryingToMantle()
|
||||
{
|
||||
return MantleSystem.IsMantlePossible && GetMoveInput().Z < -0.5f && _isJumpInputPressed;
|
||||
return MantleSystem.IsMantlePossible && IsPlayerInputtingForward() && _isJumpInputPressed;
|
||||
}
|
||||
|
||||
public void HandleGrounded(float delta)
|
||||
@@ -640,16 +652,15 @@ public partial class PlayerController : CharacterBody3D
|
||||
return;
|
||||
}
|
||||
|
||||
if (_onWallHuggingCoyoteEnabled.Active || _onWallRunningCoyoteEnabled.Active)
|
||||
{
|
||||
if (!_isWallJumpAvailable)
|
||||
{
|
||||
OnJumpFromWall();
|
||||
}
|
||||
}
|
||||
if (_onWall.Active && !_isWallJumpAvailable && IsFacingWall()) return;
|
||||
_playerState.SendEvent("jump");
|
||||
}
|
||||
|
||||
public bool IsFacingWall()
|
||||
{
|
||||
return _wallHugStartNormal.Dot(GetGlobalForwardFacingVector()) < -0.5f;
|
||||
}
|
||||
|
||||
public void OnInputJumpOngoing()
|
||||
{
|
||||
}
|
||||
@@ -672,7 +683,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
public void OnDoubleJumpStarted()
|
||||
{
|
||||
_canDash = true;
|
||||
_canDashAirborne = true;
|
||||
// _canDashAirborne = true;
|
||||
OnJumpStarted(DoubleJumpStartVelocity);
|
||||
}
|
||||
public void OnMegaJumpStarted()
|
||||
@@ -703,9 +714,16 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
|
||||
public void OnJumpFromWall()
|
||||
{
|
||||
if (!IsFacingWall())
|
||||
{
|
||||
ComputeJumpFromWallHSpeed(WallJumpStartVelocity);
|
||||
}
|
||||
// Remove the ability to dash straight away so you cannot scale up the wall
|
||||
_canDashAirborne = false;
|
||||
_airborneDashCooldownTimer.Start();
|
||||
_isWallJumpAvailable = false;
|
||||
}
|
||||
public void OnMegajumpFromWall()
|
||||
{
|
||||
ComputeJumpFromWallHSpeed(WallMegajumpStartVelocity);
|
||||
@@ -1367,6 +1385,11 @@ public partial class PlayerController : CharacterBody3D
|
||||
WeaponRoot.SetRotation(HeadSystem.Rotation);
|
||||
}
|
||||
|
||||
public Vector3 GetGlobalForwardFacingVector()
|
||||
{
|
||||
return Transform.Basis * HeadSystem.Transform.Basis * Vector3.Forward;
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Processes //////////////
|
||||
///////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user