Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser
Quick Information
A simple state machine for Godot defined solely in codeCreate a StateMachine and add states to it. Pass your own functions to a state to execute code on enter, process, physics process, and exit calls. Transfer states with one function call.For more information see the README
Programmatic State Machine
A simple state machine for Godot defined solely in code
This plugin defines two classes: State and StateMachine
Create a new StateMachine by defining a variable:
var state_m = StateMachine.create(self)
Add states by calling:
state_m.add_state("State Name", enter_func, process_func, physics_process_func, exit_func)
transfer between states using:
state_m.transfer("StateName")
The state machine will automatically handle state transitions and call the correct functions.
State Dependency
State dependencies are created to handle state transfers during asynchronous transfer calls.
To create a dependency, get the current state ID and save it to a variable. In the transfer call, pass the saved state ID as a parameter.
var state_id = state_m.get_current_state_id()
await get_tree().create_timer(1.0).timeout
state_m.transfer("NextState", state_id)
For a more in-depth example, see StateMachineExample.tscn
A simple state machine for Godot defined solely in code
Create a StateMachine and add states to it. Pass your own functions to a state to execute code on enter, process, physics process, and exit calls. Transfer states with one function call.
For more information see the README
Reviews
Quick Information
A simple state machine for Godot defined solely in codeCreate a StateMachine and add states to it. Pass your own functions to a state to execute code on enter, process, physics process, and exit calls. Transfer states with one function call.For more information see the README