First of all, I want to make it very clear that I am a beginner with little experience with Roblox Lua. Lua itself is not an issue for me, that I’ve gotten through already.
As a beginner, I’m still on the “starting low” process, of course. So being a huge fan of movement in games, I’m hoping that a movement system is simple enough for me to figure out and script “by myself” (me, the DevForum and API). Specially if I plan on “improving” Roblox default movement.
What I was thinking about is breaking movement down in multiple states (walking, sprinting, jumping, and so on), and having a better way of handling the player speed, as simply using the Humanoid’s WalkSpeed value doesn’t seem that practical for a game in which, for example, the player can get faster and faster from practice/training/progression, while each state will have a different speed, such as the player being faster while sprinting when compared to walking.
Few examples of how certain games deal with movement;
- "Mighty Omega"
Players have two different states for running; jogging, that conserves Stamina at the cost of speed, and sprinting, consuming more Stamina while also running at their max speed. Players can also increase their overall running speed in-game via training.
- "Grand Piece Online"
Players can walk and run at fixed speed. While blocking, their movement is slowed down, and with certain “powers”, they can Fly at speeds much different than their “grounded movement”.
- "Zenkai Origins"
Players have multiple states of movement; walking, sprinting, floating, flying, and “boost flying”. Each one at very different speeds, those which can be increase from stat points and using “temporary power boosts”.
- "Parkour"
By far the Roblox game with the most advanced movement. Not only the player’s movement speed includes momentum, slowly building up speed, but there are also a few “states” in which the player has different move speeds, such as crawling, running, wall-running, wall-climbing, and so on. I do recommend trying this game out, as its movement is way more complex than I can explain.
I highly doubt this game’s movement is built strictly using Humanoid’s WalkSpeed.
Of course, I’m not sure if any of those games use a “state based system”, but you can break their movement down using one, and that’s the goal I’m trying to achieve in my system; breaking movement down in different states so it becomes easier to manage when the character’s speed can be increased or decreased in certain situations. Note that I’m merely making a project, not a whole game, that would be too much for a beginner like me.
So, how difficult would it be to achieve that? What would I need to learn to reach that goal? Is it possible to “improve” how Roblox handles movement, making it more malleable?
A reminder that I’m not asking for a code, I can’t learn that way. Using a code to give me an insight is alright, though, as it would help me visualize what I’m supposed to do and what I’m supposed to search for to get a better understanding of that planned system.
TL;DR - How difficult would it be to divide character movement into multiple states, such as walking, running, flying and jumping? Is it possible to make a new movement system instead of using Roblox’s Humanoid WalkSpeed, or making a more malleable system from it? Which methods would be most appropriate for doing so?
Thank you for the read, and forgive the wall of text.