Skip to content

key_pressed

Check whether a press was observed in the current logical tick. Available as key_pressed after import_globals() or mv.input.key_pressed.

Parameters

  • name — A key name or a KEY_* constant.
if key_pressed(KEY_SPACE) then
play_sound(jump)
end

Related: key, key_released.

See the keyboard guide for more examples and limits.