Skip to content

raylib.IsKeyDown

JoeStrout edited this page Oct 17, 2026 · 3 revisions

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