bianco = Color.new(255,255,255)
rosso = Color.new(255,0,0)
pic = Image.load("SYSTEM/resources/background/usedbackground/backg.png")
bar = Image.load("SYSTEM/resources/other/bar.png")
LS = Image.load("SYSTEM/resources/other/LS.png")
fr1=Image.load("SYSTEM/resources/other/frm3.png")

SelectedC = 45
timerC = 0
timerD = 0

sbar = 102
timerBAR1 = 0
timerBAR2 = 0

while true do
pad = Controls.read()

if 1==1 then System.setcpuspeed(333) end

screen:blit(0,0,pic)
screen:blit(90,30,LS)
screen:blit(250,30,LS)
screen:blit(sbar,SelectedC,bar)
screen:blit(5,233,fr1)

screen:print(77,5,"LEVEL SELECTION MENU :",rosso)
screen:print(77,6,"LEVEL SELECTION MENU :",rosso)

screen:print(110,46,"-  Level 1",bianco)
screen:print(110,56,"-  Level 2",bianco)
screen:print(110,66,"-  Level 3",bianco)
screen:print(110,76,"-  Level 4",bianco)
screen:print(110,86,"-  Level 5",bianco)
screen:print(110,96,"-  Level 6",bianco)
screen:print(110,106,"-  Level 7",bianco)
screen:print(110,116,"-  Level 8",bianco)
screen:print(110,126,"-  Level 9",bianco)
screen:print(110,136,"-  Level 10",bianco)
screen:print(110,146,"-  Level 11",bianco)
screen:print(110,156,"-  Level 12",bianco)
screen:print(110,166,"-  Level 13",bianco)
screen:print(110,176,"-  Level 14",bianco)
screen:print(110,186,"-  Level 15",bianco)
screen:print(110,196,"-  Level 16",bianco)
screen:print(110,206,"-  Level 17",bianco)




screen:print(270,46,"-  Extra 1",bianco)
screen:print(270,56,"-  Extra 2",bianco)
screen:print(270,66,"-  Extra 3",bianco)


if pad:right() then timerBAR1 = timerBAR1 + 1 end
if not pad:right() then timerBAR1 = 0 end 
if timerBAR1 == 1 then sbar = sbar + 160 end

if pad:left() then timerBAR2 = timerBAR2 + 1 end
if not pad:left() then timerBAR2 = 0 end 
if timerBAR2 == 1 then sbar = sbar - 160 end

if sbar== -58 then sbar = 102 end
if sbar== 422 then sbar = 262 end

if sbar == 262 and SelectedC==45 then screen:print(270,46,"-> Extra 1",rosso) end
if sbar == 262 and SelectedC==55 then screen:print(270,56,"-> Extra 2",rosso) end
if sbar == 262 and SelectedC==65 then screen:print(270,66,"-> Extra 3",rosso) end


if sbar == 262 and SelectedC == 75 then SelectedC = 65 end

if SelectedC > 55 then if pad:right() then SelectedC = 45 end end





if pad:up() then timerC = timerC + 1 end
if not pad:up() then timerC = 0 end
if timerC == 1 then SelectedC = SelectedC - 10 end

if pad:down() then timerD = timerD + 1 end
if not pad:down() then timerD = 0 end 
if timerD == 1 then SelectedC = SelectedC + 10 end

if SelectedC == 215 then SelectedC = 205 end
if SelectedC == 35 then SelectedC = 45 end

if SelectedC == 45 and sbar==102 then screen:print(110,46,"-> Level 1",rosso) end
if SelectedC == 55 and sbar==102 then screen:print(110,56,"-> Level 2",rosso) end
if SelectedC == 65 and sbar==102 then screen:print(110,66,"-> Level 3",rosso) end
if SelectedC == 75 and sbar==102 then screen:print(110,76,"-> Level 4",rosso) end
if SelectedC == 85 and sbar==102 then screen:print(110,86,"-> Level 5",rosso) end
if SelectedC == 95 and sbar==102 then screen:print(110,96,"-> Level 6",rosso) end
if SelectedC == 105 and sbar==102 then screen:print(110,106,"-> Level 7",rosso) end
if SelectedC == 115 and sbar==102 then screen:print(110,116,"-> Level 8",rosso) end
if SelectedC == 125 and sbar==102 then screen:print(110,126,"-> Level 9",rosso) end
if SelectedC == 135 and sbar==102 then screen:print(110,136,"-> Level 10",rosso) end
if SelectedC == 145 and sbar==102 then screen:print(110,146,"-> Level 11",rosso) end
if SelectedC == 155 and sbar==102 then screen:print(110,156,"-> Level 12",rosso) end
if SelectedC == 165 and sbar==102 then screen:print(110,166,"-> Level 13",rosso) end
if SelectedC == 175 and sbar==102 then screen:print(110,176,"-> Level 14",rosso) end
if SelectedC == 185 and sbar==102 then screen:print(110,186,"-> Level 15",rosso) end
if SelectedC == 195 and sbar==102 then screen:print(110,196,"-> Level 16",rosso) end
if SelectedC == 205 and sbar==102 then screen:print(110,206,"-> Level 17",rosso) end



if SelectedC == 45 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index1.lua")end
if SelectedC == 55 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index2.lua")end
if SelectedC == 65 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index3.lua")end
if SelectedC == 75 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index4.lua")end
if SelectedC == 85 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index5.lua")end
if SelectedC == 95 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index6.lua")end
if SelectedC == 105 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index7.lua")end
if SelectedC == 115 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index8.lua")end
if SelectedC == 125 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index9.lua")end
if SelectedC == 135 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index10.lua")end
if SelectedC == 145 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index11.lua")end
if SelectedC == 155 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index12.lua")end
if SelectedC == 165 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index13.lua")end
if SelectedC == 175 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index14.lua")end
if SelectedC == 185 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index15.lua")end
if SelectedC == 195 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index16.lua")end
if SelectedC == 205 and pad:cross() and sbar==102 then dofile("SYSTEM/GAME/index17.lua")end


if SelectedC == 45 and pad:cross() and sbar==262 then dofile("SYSTEM/GAME/index18.lua")end
if SelectedC == 55 and pad:cross() and sbar==262 then dofile("SYSTEM/GAME/index19.lua")end
if SelectedC == 65 and pad:cross() and sbar==262 then dofile("SYSTEM/GAME/index20.lua")end

screen:print(10,240,"Press X to CONFIRM",rosso)
screen:print(10,250,"Press O to return to the MAIN MENU",rosso)
if pad:circle() and timer3>20 then dofile("SYSTEM/resources/menu/menu.lua") end

screen.waitVblankStart()
screen.flip()
screen:clear()
end
