• Godot HelpProgramming
  • How do I set up a good simple yet powerful FSM (Finite State Machine) for my 2D Platformer

Hey all. I've been trying to make a basic 2D Platformer game using State Machines. I've been using my State Machine with the 1 script method. Putting all my states and everything else in 1 script . I'm trying to make my Platformer FSM like Kirby or Metroid. For example:

match state: State.IDLE: pass State.TIPTOE: pass State.RUN: pass State.JUMP: pass "this and the fall state are the trickiest. They either don't fall and they just jump or they fall and glide and they don't move while jumping." State.FALL: pass "this state might also be the one where the player could drop from a one way platform State.SHOOT: shoot() State.JUMPSHOOT: "take jump and fall but shoot while doing so" State.RUNSHOOT: pass State.CLIMB: "climb ladder" State.CLIMBSHOOT: "climbshoot" State.HURT: pass

please help

This guy has a pretty good tutorial:

You are better off to follow the Chris tutorial. One script will generally end up in a mess. The other guys code is unreadable and it's not a tutorial. It will look complicated at first but just follow it and after you get it working, make small changes here and there until you are sure you understand it. Keep the docs handy and look up keywords you don't understand. You could look up Finite State Machine in this search area for one script solutions also, but I think you will learn more from that tutorial myself.

a year later