Skip to content

raylib.IsKeyDown

JoeStrout edited this page Apr 29, 2026 · 2 revisions

Check if a key is being pressed (key held down)

Parameters

Parameter Default Value Note
key

Return value

Condition Return Value
(always) number

Notes

Example

raylib.InitWindow 800, 600, "Key Down Demo"
x = 400
while not raylib.WindowShouldClose
    if raylib.IsKeyDown(raylib.KEY_RIGHT) then x = x + 4
    if raylib.IsKeyDown(raylib.KEY_LEFT) then x = x - 4
    raylib.BeginDrawing
    raylib.ClearBackground color.white
    raylib.DrawCircle x, 300, 20, color.blue
    raylib.EndDrawing
end while
raylib.CloseWindow

Clone this wiki locally