MovementStateComponent ​
Inherits: RefCounted
MovementStateComponent handles the movement state system for entities. It manages transitions between different movement states like idle, walking, running, etc. Simplified for blending system - animations blend automatically between states. Also handles physics for displacement effects.
Variables ​
MovementStateComponent.MovementStateName | initial_state | MovementStateName.IDLE |
bool | has_idle_state | true |
bool | has_walking_state | true |
bool | has_running_state | true |
bool | has_falling_state | true |
bool | has_idle_turning_state | true |
bool | has_displaced_state | true |
bool | has_directional_state | true |
bool | has_climbing_state | true |
MovementState | current_state | |
Dictionary | states | {} |
Entity | entity |
Methods ​
void | initialize_movement_state_component( entity_ref: Entity ) |
void | set_active_state( active: bool ) |
void | process_movement( delta: float ) |
void | change_movement_state( state_name: MovementStateName, _caller: String = "NotDefined" ) |
MovementState | get_state( state_name: MovementStateName ) |
Enumerations ​
enum MovementStateName ​
The options of movement state name: idle, idle turning, moving, falling, directional, climbing.
- IDLE =
0 - IDLE_TURNING =
1 - MOVING =
2 - FALLING =
3 - DIRECTIONAL =
4 - CLIMBING =
5
Variable descriptions ​
MovementStateComponent.MovementStateName initial_state = MovementStateName.IDLE ​
Initial movement state to be set on startup
bool has_idle_state = true ​
Flags to enable/disable specific movement states
bool has_walking_state = true ​
True when the entity has a walking state.
bool has_running_state = true ​
True when the entity has a running state.
bool has_falling_state = true ​
True when the entity has a falling state.
bool has_idle_turning_state = true ​
True when the entity has a turn in place state.
bool has_displaced_state = true ​
True when the entity has a displaced state (it is pushed or pulled).
bool has_directional_state = true ​
True when the entity has a directional movement state.
bool has_climbing_state = true ​
True when the entity has a climbing state.
MovementState current_state ​
Current active movement state
Dictionary states = ​
Dictionary to store all states
Entity entity ​
References
Method descriptions ​
void initialize_movement_state_component( entity_ref: Entity ) ​
Initialize the movement state manager
void set_active_state( active: bool ) ​
#Set active state for the movement manager
void process_movement( delta: float ) ​
Called every physics frame to update the current state
void change_movement_state( state_name: MovementStateName, _caller: String = "NotDefined" ) ​
Changes the current movement state
MovementState get_state( state_name: MovementStateName ) ​
Retrieves a state by name