menupos = 0
screen:clear()
screen:print(80,130,"Retrieving Option Settings. Please wait.", green)
screen.flip()
screen.waitVblankStart(120)
--fastmini = Sound.load("fast.wav")
--popcornmini = Sound.load("popcorn.wav")

while true do
pad = Controls.read()
screen:clear()
screen:blit(0,0,optionsmenu)

if menupos == 0 then
screen:blit(190, 50, selector)
end

if menupos == 1 then
screen:blit(260, 50, selector)
end

if menupos == 2 then
screen:blit(330, 50, selector)
end

if menupos == 3 then
screen:blit(400, 50, selector)
end

if menupos == 4 then
screen:blit(260, 100, selector)
end

if menupos == 5 then
screen:blit(330, 100, selector)
end

if menupos == 6 then
screen:blit(400, 100, selector)
end


if pad:right() and menupos == 4 then
screen.waitVblankStart(5)
menupos = menupos + 1
screen.waitVblankStart(5)

    else if pad:right()and menupos == 5 then
    screen.waitVblankStart(5)
    menupos = menupos + 1
    screen.waitVblankStart(5)
    
        else if pad:right()and menupos == 6 then
        screen.waitVblankStart(5)
        menupos = menupos - 2
        screen.waitVblankStart(5)


else if pad:left() and menupos == 4 then
screen.waitVblankStart(5)
menupos = menupos + 2
screen.waitVblankStart(5)
        
        else if pad:left()and menupos == 5 then
        screen.waitVblankStart(5)
        menupos = menupos - 1
        screen.waitVblankStart(5)

              else if pad:left()and menupos == 6 then
              screen.waitVblankStart(5)
              menupos = menupos - 1
              screen.waitVblankStart(5)


end
end
end
end
end
end 


if pad:right() and menupos == 0 then
screen.waitVblankStart(5)
menupos = menupos + 1
screen.waitVblankStart(5)

    else if pad:right()and menupos == 1 then
    screen.waitVblankStart(5)
    menupos = menupos + 1
    screen.waitVblankStart(5)
    
        else if pad:right()and menupos == 2 then
        screen.waitVblankStart(5)
        menupos = menupos + 1
        screen.waitVblankStart(5)

            else if pad:right()and menupos == 3 then
            screen.waitVblankStart(5)
            menupos = menupos - 3
            screen.waitVblankStart(5)


else if pad:left() and menupos == 0 then
screen.waitVblankStart(5)
menupos = menupos + 3
screen.waitVblankStart(5)
        
        else if pad:left()and menupos == 1 then
        screen.waitVblankStart(5)
        menupos = menupos - 1
        screen.waitVblankStart(5)

              else if pad:left()and menupos == 2 then
              screen.waitVblankStart(5)
              menupos = menupos - 1
              screen.waitVblankStart(5)

                  else if pad:left()and menupos == 3 then
                  screen.waitVblankStart(5)
                  menupos = menupos - 1
                  screen.waitVblankStart(5)

end
end
end
end
end
end 
end
end

if pad:up() and menupos == 4 then
screen.waitVblankStart(5)
menupos = 0
screen.waitVblankStart(5)

    else if pad:up() and menupos == 5 then
    screen.waitVblankStart(5)
    menupos = 0
    screen.waitVblankStart(5)

        else if pad:up() and menupos == 6 then
        screen.waitVblankStart(5)
        menupos = 0
        screen.waitVblankStart(5)

end
end
end


if pad:down() and menupos == 0 then
screen.waitVblankStart(5)
menupos = 4
screen.waitVblankStart(5)

    else if pad:down() and menupos == 1 then
    screen.waitVblankStart(5)
    menupos = 4
    screen.waitVblankStart(5)

        else if pad:down() and menupos == 2 then
        screen.waitVblankStart(5)
        menupos = 4
        screen.waitVblankStart(5)
        
            else if pad:down() and menupos == 3 then
            screen.waitVblankStart(5)
            menupos = 4
            screen.waitVblankStart(5)

end
end
end
end


if pad:cross()and menupos == 0 then
voice:stop()
bgmusic = popcorn
screen:print(126,150,"You have selected song #1: Popcorn", pink)
soundmini[1].loop=false
local sound = popcorn
voice = sound:play()
screen.flip()
screen.waitVblankStart(100)
voice:stop()
local sound = menumsk
voice = sound:play()



    else if pad:cross()and menupos == 1 then
voice:stop()
    bgmusic = move
    screen:print(126,150,"You have selected song #2: Move Your Body", pink)
soundmini[1].loop=false
local sound = move
voice = sound:play()
    screen.flip()
    screen.waitVblankStart(142)
voice:stop()
local sound = menumsk
voice = sound:play()


        else if pad:cross()and menupos == 2 then
voice:stop()
        bgmusic = fast
        screen:print(126,150,"You have selected song #3:", pink)
screen:print(126,160,"Hall Of The Mountain King (Dance Remix)", pink)
soundmini[1].loop=false
local sound = fast
voice = sound:play()
        screen.flip()
        screen.waitVblankStart(160)
voice:stop()
local sound = menumsk
voice = sound:play()


            else if pad:cross()and menupos == 3 then
voice:stop()
            bgmusic = eminem
            screen:print(126,150,"You have selected song #4: Without Me", pink)
soundmini[1].loop=false
local sound = eminem
voice = sound:play()
            screen.flip()
            screen.waitVblankStart(220)
voice:stop()
local sound = menumsk
voice = sound:play()
end
end
end
end


if pad:cross()and menupos == 4 then
background = lua_background
screen:print(126,150,"You have selected background #1: Lua", pink)
minipic = luamini
screen:blit(312, 170, minipic, false)
screen.flip()
screen.waitVblankStart(120)


    else if pad:cross()and menupos == 5 then
    background = disco_background
    screen:print(126,150,"You have selected background #2: Club", pink)
minipic = clubmini
screen:blit(312, 170, minipic, false)
    screen.flip()
    screen.waitVblankStart(120)


        else if pad:cross()and menupos == 6 then
        background = beach_background
        screen:print(126,150,"You have selected background #3: Beach ", pink)
minipic = beachmini
screen:blit(312, 170, minipic, false)
        screen.flip()
        screen.waitVblankStart(120)


end
end
end

if pad:circle() then
dofile ("mainnosnd.lua")
end


if pad:select() then
dofile ("screenshot.lua")
end

if exit == 1 then
break
end

screen.flip()
screen.waitVblankStart()
end