Lua
natiny.input.get_touch_x_speed(touch) -> speed
Returns the touch movement along the x axis since the previous frame, in the
window's current drawing units.
Parameters
Returns
| Type |
Description |
number |
Signed horizontal movement in drawing units; positive to the right, negative to the left, or 0 for a new or invalid touch |
Example
Lua
for index = 0, natiny.input.get_touch_count() - 1 do
local touch = natiny.input.get_touch_at(index)
if natiny.input.get_touch_down(touch) then
camera_x = camera_x - natiny.input.get_touch_x_speed(touch)
end
end
Notes
- Touch input is available on Android and in touch-enabled browsers.