This repository is an implementation of the state pattern, used for a platformer character in the Godot engine.
Each state is a separate node, and there are also utility classes for behaviour shared between states. It was built with extensibility in mind; it should be easy to build on the existing structure to create state machines that are more complex or even of a different type (such as a hierarchical state machine).
The project included in this repository serves as an example for the state machine implementation. You can download it to run and jump around with a character that was programmed using the state machine!
By the way, the character in the example uses the cutout animation style, so this project also kinda-sorta doubles as an example for using the AnimationPlayer node with several animation tracks.
Just clone the repository, download Godot, open up the project.godot
file in the editor, and you're good to go! The controls for the demo are arrow keys to move and space bar to jump.
- Made by Alex Kitt