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