I’ve tried multiple methods of trying to get things to move constantly when the screen is touched and held. Nothing is working for me. Can someone please help?
I’ve tried this and variations and it still has not worked:
local holding = false local function enterFrameListener() if holding then -- Holding button -- Code here -- Code here -- Code here else -- Not holding -- Code here -- Code here -- Code here end end local function touchHandler( event ) if event.phase == "began" then display.getCurrentStage():setFocus( event.target ) event.target.isFocus = true Runtime:addEventListener( "enterFrame", enterFrameListener ) holding = true elseif event.target.isFocus then if event.phase == "moved" then elseif event.phase == "ended" then holding = false Runtime:removeEventListener( "enterFrame", enterFrameListener ) display.getCurrentStage():setFocus( nil ) event.target.isFocus = false end end return true end
Any suggestions?