Hi
I need your help on a simple proto
Here the main.lua code. (You can download lineTouch.zip to test directly the code)
------------------------------------------------------------------------------------ -- main.lua ------------------------------------------------------------------------------------ --Touch listener local function touchListener(event) --Reference to the touch object local target = event.target --On "began" phase, we color the object in green if event.phase == "began" then target:setFillColor(0,1,0) --On "moved" phase, we color the object in red elseif event.phase == "moved" then target:setFillColor(1,0,0) end end -- We create 30 vertical lines, each one listen to the "touch" event for i = 1, 30 do local verticalLine = display.newRect( 0, 0, 5, 300 ) verticalLine:setFillColor(1,1,1) verticalLine.y = display.contentCenterY verticalLine.x = 33 \* i verticalLine:addEventListener("touch", touchListener) end
TEST PROCESS :
-
Firstly, swipe slowly on screen from the left to the right : you can see that each vertical line becomes red. Ok.
-
Secondly, swipe quickly on screen from the left to the right : you can see that some vertical lines becomes red and some remain white.
Is there a way for all lines to turn red regardless of swipe speed?
Do you have an idea?
Any help would be great!
Thanks!
Best,
Olivier