Skip to content

Class "Input"⚓︎

Info

In this class you need to use a . (Dot) to access its functions instead of a : (colon)!

Example: Input.GetMousePosition(true)

Functions⚓︎

Get·Action·Value ()⚓︎

float GetActionValue ( int action, int controllerId )⚓︎

Returns the current strength in which a button was pressed. This is 0 OR 1 with a keyboard. With a controller, this can be used to get the strength in which you have moved the analog stick in a direction.

Example Code

This code prints the current "strength" in which the analog stick was moved to the left.

1
print(Input.GetActionValue(ButtonAction.ACTION_LEFT, 1))


Get·Button·Value ()⚓︎

float GetButtonValue ( int button, int controllerId )⚓︎

Use "GetActionValue" instead of this function.


Get·Mouse·Position ()⚓︎

Vector GetMousePosition ( boolean gameCoords )⚓︎

Returns the current mouse position in game coordinates (true) or render coordinates.

Example Code

This code renders "Hello World!" at the current mouse position.

1
2
3
local mousePos = Input.GetMousePosition(true) -- get mouse position in world coordinates
local screenPos = Isaac.WorldToScreen(mousePos) -- transfer game- to screen coordinates
Isaac.RenderText("Hello World!", screenPos.X, screenPos.Y, 1 ,1 ,1 ,1 )


Is·Action·Pressed ()⚓︎

boolean IsActionPressed ( int action, int controllerId )⚓︎

Returns, if an action-button is pressed or not. An Action-button is any button that got a default function assigned to it. This function will return true, as long the button is held down.

List of all Action enums

Example Code

This code prints "bomb Button pressed", when any button was pressed that is assigned to the "place bomb" function.

1
2
3
if Input.IsActionPressed(ButtonAction.ACTION_BOMB, 0)  then
    print("bomb Button pressed")
end


Is·Action·Triggered ()⚓︎

boolean IsActionTriggered ( int action, int controllerId )⚓︎

Returns, if an action-button was pressed some time before or not. An Action-button is any button that got a default function assigned to it. This functions will only return true, if the button was pressed down. It will no longer return true, after you called this function and try to call it in the next update cycle (for example in the next render cycle).

List of all Action enums

Example Code

This code prints "bomb Button pressed", when any button was pressed that is assigned to the "place bomb" function.

1
2
3
if Input.IsActionTriggered(ButtonAction.ACTION_BOMB, 0)  then
    print("bomb Button pressed")
end


Is·Button·Pressed ()⚓︎

boolean IsButtonPressed ( int button, int controllerId )⚓︎

Returns, if a button is pressed or not. This function will return true, as long the button is held down.

List of all Action enums

Example Code

This code prints "Enter Button pressed", when the "Enter"-Button was pressed.

1
2
3
if Input.IsButtonPressed(Keyboard.KEY_ENTER, 0)  then
    print("Enter Button pressed.")
end


Is·Button·Triggered ()⚓︎

boolean IsButtonTriggered ( int button, int controllerId )⚓︎

Returns, if a button was pressed some time before or not. This functions will only return true, if the button was pressed down. It will no longer return true, after you called this function and try to call it in the next update cycle (for example in the next render cycle).

List of all Action enums

Example Code

This code prints "Enter Button was pressed", when the "Enter"-Button was pressed.

1
2
3
if Input.IsButtonTriggered(Keyboard.KEY_ENTER, 0)  then
    print("Enter Button was pressed.")
end


Is·Mouse·Btn·Pressed ()⚓︎

boolean IsMouseBtnPressed ( int button )⚓︎

Returns, if a mousebutton is pressed or not. Left: 0, Right: 1, mousewheel: 2, back button: 3, forward button: 4

Example Code

This code prints "Right Click", when the "right"-mousebutton was pressed.

1
2
3
if Input.IsMouseBtnPressed(1)  then
    print("Right Click")
end



Last update: September 14, 2022