Kraken Logo

Kraken Engine

DocumentationGuidesShowcaseCommunity
Ctrl
K
Navigating the Docs
Building Docs
Overview
Camera
Color
Draw
Ease
Event
Fx
Gamepad
Input
Log
Math
Mixer
Mouse
Physics
Pixel Array
Renderer
Shaders
Time
Transform
Ui
Viewport
Window

Built bydurkisneer1.Kraken Engine is open source and available onGitHub.

  1. Docs
  2. Functions
  3. Input

Input

Input handling and action binding


Bind

bind(name: str, actions: Sequence[InputAction]) → Nonebind(name: str, actions: Sequence[InputAction]) → None

Bind 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

unbind(name: str) → Noneunbind(name: str) → None

Unbind a previously registered input name.

Args

  • name : The binding name to remove.

Get Direction

get_direction(up: str, right: str, down: str, left: str) → Vec2get_direction(up: str, right: str, down: str, left: str) → Vec2

Get 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

get_axis(negative: str, positive: str) → floatget_axis(negative: str, positive: str) → float

Get 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

is_pressed(name: str) → boolis_pressed(name: str) → bool

Check 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

is_just_pressed(name: str) → boolis_just_pressed(name: str) → bool

Check 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

is_just_released(name: str) → boolis_just_released(name: str) → bool

Check 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.

PreviousGamepad
NextLog

On this page

BindUnbindGet DirectionGet AxisIs PressedIs Just PressedIs Just Released