Input
Functions for handling input actions and bindings.
Bind
bind(name: str, actions: list[InputAction]) → None
Bind a list of input actions to a name.
Parameters
name
: The name to bind the actions to.actions
: The list of input actions to bind.
Unbind
unbind(name: str) → None
Unbind all input actions associated with a name.
Parameters
name
: The name to unbind the actions from.
Get Direction
get_direction(up: str, right: str, down: str, left: str) → Vec2
Get the direction vector based on the input actions.
Parameters
up
: The name of the input action for moving up.right
: The name of the input action for moving right.down
: The name of the input action for moving down.left
: The name of the input action for moving left.
Returns
Vec2
: A vector representing the direction based on the input actions.
Get Axis
get_axis(negative: str, positive: str) → float
Get the axis value based on the input actions.
Parameters
negative
: The name of the input action for moving in the negative direction.positive
: The name of the input action for moving in the positive direction.
Returns
float
: A float representing the axis value based on the input actions.
Is Pressed
is_pressed(name: str) → bool
Check if an input action is currently pressed.
Parameters
name
: The name of the input action to check.
Returns
bool
: A boolean indicating whether the input action is currently pressed.
Is Just Pressed
is_just_pressed(name: str) → bool
Check if an input action was just pressed.
Parameters
name
: The name of the input action to check.
Returns
bool
: A boolean indicating whether the input action was just pressed.
Is Just Released
is_just_released(name: str) → bool
Check if an input action was just released.
Parameters
name
: The name of the input action to check.
Returns
bool
: A boolean indicating whether the input action was just released.