Edit of asset "Hierarchical Finite State Machine Demo" Accepted

Old/Current New/Edit
Title Hierarchical Finite State Machine Demo Hierarchical Finite State Machine Demo
Description This example shows how to apply the State machine programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.

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: https://gameprogrammingpatterns.com/state.html

Language: GDScript

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

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: https://gameprogrammingpatterns.com/state.html

Language: GDScript

Renderer: Compatibility
Category Demos Demos
License MIT MIT
Repository Provider Custom Custom
Repository Url https://github.com/godotengine/godot-demo-projects/tree/4.2-31d1c0c/2d/finite_state_machine https://github.com/godotengine/godot-demo-projects/tree/4.2-31d1c0c/2d/finite_state_machine
Issues Url https://github.com/godotengine/godot-demo-projects/issues https://github.com/godotengine/godot-demo-projects/issues
Godot version Godot 4.2 Godot 4.2
Version String 4.2-31d1c0c 4.2-31d1c0c
Download Commit https://github.com/godotengine/godot-demo-projects/releases/download/4.2-31d1c0c/2d_finite_state_machine.zip https://github.com/godotengine/godot-demo-projects/releases/download/4.2-31d1c0c/2d_finite_state_machine.zip
Download Url (Computed) https://github.com/godotengine/godot-demo-projects/releases/download/4.2-31d1c0c/2d_finite_state_machine.zip https://github.com/godotengine/godot-demo-projects/releases/download/4.2-31d1c0c/2d_finite_state_machine.zip
Icon Url https://raw.githubusercontent.com/godotengine/godot-demo-projects/4.2-31d1c0c/2d/finite_state_machine/icon.webp
https://raw.githubusercontent.com/godotengine/godot-demo-projects/4.2-31d1c0c/2d/finite_state_machine/icon.webp
Preview Insert
Type image
Image/Video URL https://raw.githubusercontent.com/godotengine/godot-demo-projects/4.2-31d1c0c/2d/finite_state_machine/screenshots/fsm-attack.png
Thumbnail