Incidentally, I also found PlayMaker (which I love) to be not so good for core mechanics of a platformer. It works somewhat for a simple design. Days ago, I finally caved and implemented a player controller with a c# script, but also compared it to an identical FSM. The PM one really did lag behind a bit.
Hello Zabuton,
1) Look for GetAxisRaw to get the axis. This is more responsive.
2) Set Velocity causes trouble when you want to use physics, because it overrides the velocity physics forces. Use Add Force, set it high and cap (clamp) the velocity value to the max speed. This also feels better, however I do not know if there is a clamp velocity in the ecosystem. Below is a simpler version.
3) For a start, use one FSM for
each mechanic. Movement and flip can be one FSM at first. Here’s a simple setup, out of the top of my mind.
MOVE
Move Right FloatCompare (if axis < -0.1 Go to Move Left state)
GetAxisRaw
SetVelocity
Once: set scale X = 1
Move Left FloatCompare (if axis > 0.1 Go to Move Right state)
GetAxisRaw
SetVelocity
Once: set scale X = -1
JUMP
Watch GetButtonDown (go to check)
CheckGet FSM bool onGround (from Senses), if true, jump
Do JumpAdd Force up
SENSES
WatchCast one or several rays down.
If Any True (then onGround = true)
And so on. I recommend to start simple, get it working. And as needed, add complexity. If anything gets too big, simply put it into another FSM.
Look into send event, and get fsm or set fsm variables to communicate between FSMs and good luck.