Aaron Franke f28a09ea0d Fix bullets in the Finite State Machine demo 3 년 전
..
debug 7e129db12e Use "not" instead of the exclamation mark in GDScript files 3 년 전
fonts 5b744fa1e6 Add HFSM + pushdown automaton demo 6 년 전
player f28a09ea0d Fix bullets in the Finite State Machine demo 3 년 전
screenshots fcc7d5c723 Optimize PNG images using oxipng 4 년 전
state_machine 006309bd6f Many tweaks thanks to IAmActuallyCthulhu 4 년 전
Demo.tscn f28a09ea0d Fix bullets in the Finite State Machine demo 3 년 전
README.md d4bf89d364 Link to the asset library from the README of each demo 4 년 전
icon.png fcc7d5c723 Optimize PNG images using oxipng 4 년 전
icon.png.import a45b84a5ad Handle multiple resolutions in most demos 5 년 전
project.godot 814909538f Update projects to Godot 3.3 3 년 전

README.md

Hierarchical Finite State Machine

This example shows how to apply the State machine programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.

Language: GDScript

Renderer: GLES 2

Check out this demo on the asset library: https://godotengine.org/asset-library/asset/516

Why use a state machine

States are common in games. You can use the pattern to:

  1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage.

  2. Respect the Single Responsibility Principle. Each State object represents one action.

  3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.

You can read more about States in the excellent Game Programming Patterns ebook.

Screenshots

Screenshot