Hi, HZGaming check this out for a general dscription:
https://www.scirra.com/tutorials/1139/h ... e-machines
The state machiene would just sit there and wait for a state variable like State="MoveUp"
So when you wanted to move the player Up on a key board press you would do:
On keypress "W" ------> Set State="MoveUp"
Then later you can add on to it really easy, just replace the keyboard press with a Clicked/touched button for on screen controls.
Left clicked object = moveUp.Sprite------------------->Set State="MoveUp"
Touched object = moveUp.Sprite------------------->Set State="MoveUp"
It also allows certain states to only be active at certain times. Like if you test if he is on the ground or not lets Move, and run, and Shoot and Jump work, but when he is Not on the ground he can only be Falling or Jumping, where there are no user control so run and walk, and shoot, and jumpStart do not work while they are flying in the air.