natiny.input.get_touch_down

Lua
natiny.input.get_touch_down(touch) -> down

Returns whether the specified touch is currently in contact with the screen.

Parameters

Name Type Description
touch number Touch identifier from natiny.input.get_touch_at

Returns

Type Description
boolean true while the touch is in contact with the screen; false on its release frame or for an invalid identifier

Example

Lua
if drag and natiny.input.get_touch_down(drag) then
    camera_x = camera_x - natiny.input.get_touch_x_speed(drag)
end

Notes

  • The function returns false on the same frame that natiny.input.get_touch_released returns true.
  • Touch input is available on Android and in touch-enabled browsers.
  • The first active touch is also reported as the left mouse button. Do not process both APIs unless duplicate input is intended.