I want to create a movement system but I just don’t know where to start.
Things I want to include:
Wall Jump (with cooldown)
Momentum
Dash
Slide
More detail:
I want the player to only be able to jump on the same wall once and then they have to either
a) jump off a different wall
b) touch the floor
I am a beginner scripter so I understand if explain this to me is to inconvenient.
Momentum, aka. slippery controls can be done using ControllerManager
But it’s just annoying, it’s better to slowly increase runspeeds instead and just custom make the part that sets the humanoid walkdirection.
Wall jump, keep it simple:
if humanoid.FloorMaterial == Enum.Materials.Air and hasDoubleJump then
if raycastLeft ~= nil then
hasDoubleJump = false
humanoid:ChangeState(Enum.HumanoidState.Jump, true)
elseif raycastRight ...
After walljump you can just wait til floormaterial is not air to reset the hasDoubleJump.
Keep it simple, doesn’t have to be perfect
Not sure what the best method is but a method I prefer for momentum and similar stuff is adding onto the PlayerScipt modules ‘Move’ function.
Normally the way it works is it calculates the direction based on your camera and keys pressed and then does Player.Move(direction, … , … ).
What I do is have a variable moveDirection that starts off as Vector3.zero and when the PlayerScript gets the direction, I do:
--Direction is the direction the script calculated
--moveDirection is a variable defined outside the move function
if Direction.Magnitude == 0 then
moveDirection = moveDirection:Lerp(Direction,.1)
else
moveDirection = direction
end
the lerping makes it slowly reach zero instead of automatically stop.