Skip to content

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.MovementStateNameinitial_stateMovementStateName.IDLE
boolhas_idle_statetrue
boolhas_walking_statetrue
boolhas_running_statetrue
boolhas_falling_statetrue
boolhas_idle_turning_statetrue
boolhas_displaced_statetrue
boolhas_directional_statetrue
boolhas_climbing_statetrue
MovementStatecurrent_state
Dictionarystates{}
Entityentity

Methods ​

voidinitialize_movement_state_component( entity_ref: Entity )
voidset_active_state( active: bool )
voidprocess_movement( delta: float )
voidchange_movement_state( state_name: MovementStateName, _caller: String = "NotDefined" )
MovementStateget_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