added a max velocity for player and fixed the multiple back inputs in menus
This commit is contained in:
@@ -98,6 +98,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
// Movement stuff
|
||||
[ExportCategory("Movement")]
|
||||
[ExportGroup("General")]
|
||||
[Export(PropertyHint.Range, "10,200,0.1,or_greater")]
|
||||
public float AbsoluteMaxSpeed { get; set; } = 100f;
|
||||
[ExportGroup("Ground")]
|
||||
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
||||
public float WalkSpeed { get; set; } = 7.0f;
|
||||
@@ -1985,6 +1988,10 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
if (_currentInputBufferFrames > 0) _currentInputBufferFrames -= 1;
|
||||
|
||||
// Limit maximum speed
|
||||
if (Velocity.Length() > AbsoluteMaxSpeed)
|
||||
Velocity = Velocity.Normalized() * AbsoluteMaxSpeed;
|
||||
|
||||
// Manage head and camera movement
|
||||
LookAround(delta);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user