Input handling and action binding
bind(name: str, actions: Sequence[InputAction]) → Nonebind(name: str, actions: Sequence[InputAction]) → NoneBind a name to a list of InputActions.
Args
name : The identifier for this binding (e.g. "jump").actions : One or more InputActions to bind.unbind(name: str) → Noneunbind(name: str) → NoneUnbind a previously registered input name.
Args
name : The binding name to remove.get_direction(up: str, right: str, down: str, left: str) → Vec2get_direction(up: str, right: str, down: str, left: str) → Vec2Get a directional vector based on named input actions.
This is typically used for WASD-style or D-pad movement.
Args
up : Name of action for upward movement.right : Name of action for rightward movement.down : Name of action for downward movement.left : Name of action for leftward movement.Returns
Vec2 : A normalized vector representing the intended direction.
get_axis(negative: str, positive: str) → floatget_axis(negative: str, positive: str) → floatGet a 1D axis value based on two opposing input actions.
Args
negative : Name of the negative direction action (e.g. "left").positive : Name of the positive direction action (e.g. "right").Returns
float : Value in range [-1.0, 1.0] based on input.
is_pressed(name: str) → boolis_pressed(name: str) → boolCheck if the given action is currently being held.
Args
name : The name of the bound input.Returns
bool : True if any action bound to the name is pressed.
is_just_pressed(name: str) → boolis_just_pressed(name: str) → boolCheck if the given action was just pressed this frame.
Args
name : The name of the bound input.Returns
bool : True if pressed this frame only.
is_just_released(name: str) → boolis_just_released(name: str) → boolCheck if the given action was just released this frame.
Args
name : The name of the bound input.Returns
bool : True if released this frame only.