vendredi 11 septembre 2015

Corona SDK While loop crash

What is wrong with this code that it crashes the simulator? I'm new to Corona SDK, but I know alot of Lua from Roblox.

local x,y,touching,active = 2,2,false,true
local background = display.newImage("Icon.png",(display.pixelWidth/2)+30,y)
background:scale(60,60)
print("Started")

function move()
    y=y+1
end

function onObjectTouch(event)
    if event.phase == "began" then
        touching = true
        while touching == true do
            timer.performWithDelay( 1000, move)
        end
    elseif event.phase == "ended" then
        touching = false
    end
    return true
end

background:addEventListener("touch",onObjectTouch)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire