Help with page transition!

Well I have designed a iOS 7 styled lock pad. It is fully functional and now I need to know how I get it to open up another page when the passcode is correct. Thanks in advance!

Try putting “page transition” in the search box above

I haven’t found anything other than my post,

@iColor I don’t know what your code looks like, so I wrote this to give you an idea of going to different screens depending on a passcode error or a passcode accepted. Hope this helps.


--# Main

displayMode(FULLSCREEN)

function setup()
    fontSize(30)
    passcode="1707"
    tab="*0#789456123"
    size=100
    code=""
    state=getCode
end

function draw()
    background(40,40,50)
    state()
end

function getCode()
    text("Enter a 4 digit passcode",WIDTH/2,HEIGHT-200)
    text("press  *  to clear the code",WIDTH/2,HEIGHT-250)
    text("press  #  to accept the code",WIDTH/2,HEIGHT-300)
    c=0
    for y=1,4 do
        for x=1,3 do
            c=c+1
            fill(255)
            rect(x*size,y*size,size,size)
            fill(255,0,0)
            text(string.sub(tab,c,c),x*size+size/2,y*size+size/2)           
        end
    end
    fill(255)
    text(code,WIDTH/2,HEIGHT-100)
end

function nextScreen()
    background(0,100,0)
    text("Passcode correct",WIDTH/2,HEIGHT/2)
    text("add anything to this function",WIDTH/2,HEIGHT/2-50)
    text("press restart",WIDTH/2,HEIGHT/2-100)
end

function errorScreen()
    background(100,0,0)
    text("Passcode error",WIDTH/2,HEIGHT/2)
    text("Tap screen to try again",WIDTH/2,HEIGHT/2-50)
    code=""
end

function touched(t)
    if t.state==BEGAN then
        if state==errorScreen then
            state=getCode
            return
        end
        if state==getCode then
            tx=math.floor(t.x/size)
            ty=math.floor(t.y/size)
            pos=(ty-1)*3+tx
            val=string.sub(tab,pos,pos)
            if val=="*" then    -- clear code
                code=""
                return
            end
            if val=="#" then
                if code==passcode then
                    state=nextScreen
                    else
                    state=errorScreen
                end
                return
            end
            code=code..val
        end
    end
end