Lua
natiny.input.get_touch_pressed(touch) -> pressed
Returns true only on the frame when the specified touch first contacts the
screen.
Parameters
Returns
| Type |
Description |
boolean |
true on the touch's first frame; false on later frames or for an invalid identifier |
Example
Lua
for i = 0, natiny.input.get_touch_count() - 1 do
local touch = natiny.input.get_touch_at(i)
if natiny.input.get_touch_pressed(touch) then
fire(natiny.input.get_touch_x(touch), natiny.input.get_touch_y(touch))
end
end
Notes
- Touch input is available on Android and in touch-enabled browsers.