X pos: function onUpdate(dt)
-- Read finger drag and apply horizontal velocity to all scrollbg actors
local touch = castle.getTouch()
if touch and touch.duration > 0 and dt > 0 then
local vel = touch.deltaX / dt
local scrollActors = castle.actorsWithTag("scrollonbackground")
for _, actor in ipairs(scrollActors) do
actor.dynamicMotion.vx = vel
end
end
end
function onCreate()
end
function onMessage(message, triggeringActor)
end
Y pos: function onUpdate(dt)
-- Read finger drag and apply horizontal velocity to all scrollbg actors
local touch = castle.getTouch()
if touch and touch.duration > 0 and dt > 0 then
local vel = touch.deltaY / dt
local scrollActors = castle.actorsWithTag("scrollonbackground")
for _, actor in ipairs(scrollActors) do
actor.dynamicMotion.vy = vel
end
end
end
function onCreate()
end
function onMessage(message, triggeringActor)
end