natiny.input.get_touch_y_speed

Lua
natiny.input.get_touch_y_speed(touch) -> speed

Returns the touch movement along the y axis since the previous frame, in the window's current drawing units.

Parameters

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

Returns

Type Description
number Signed vertical movement in drawing units; positive downward, negative upward, 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_y = camera_y - natiny.input.get_touch_y_speed(touch)
    end
end

Notes

  • Touch input is available on Android and in touch-enabled browsers.