font_color = 0
current = 1
oldpad = Controls.read()
background2 = Image.load("Astroid_Escape/Images/menu2.png")

function printCentered(y,text,color)
local length = string.len(text)
local x = 240 - ((length*8)/2)
screen:print(x,y,text,color)
end

while true do
pad = Controls.read()
screen:clear()
screen:blit(0,0,background2)
font_color = font_color + 1
printCentered(50,"Through the Astroid Belt:", red)
printCentered(70,"Level 1", red)
printCentered(80,"Level 2", red)
printCentered(90,"Level 3", red)
printCentered(110,"Saturn's Rings:", red)
printCentered(130,"Level 1", red)
printCentered(140,"Level 2", red)
printCentered(150,"Level 3", red)
printCentered(170,"Around Uranus:", red)
printCentered(190,"Level 1", red)
printCentered(200,"Level 2", red)
printCentered(210,"Level 3", red)

if pad:down() and oldpad:down() ~= pad:down() then
current = current + 1
end

if pad:up() and oldpad:up() ~= pad:up() then
current = current - 1
end

if pad:circle() and oldpad:circle() ~= pad:circle() then
dofile("Astroid_Escape/mainMenu.lua")
end

if current == 1 and font_color <= 4 then
printCentered(70,"Level 1", blue)
	if pad:cross() and oldpad:cross() ~= pad:cross() then
	dofile("Astroid_Escape/1_1.lua")
	end
end

if current == 1 and font_color > 4 then
printCentered(70,"Level 1", white)
	if pad:cross() and oldpad:cross() ~= pad:cross() then
	dofile("Astroid_Escape/1_1.lua")
	end
end

if current == 2 and font_color <= 4 then
printCentered(80,"Level 2", blue)
	if pad:cross() and oldpad:cross() ~= pad:cross() then
	dofile("Astroid_Escape/1_2.lua")
	end
end

if current == 2 and font_color > 4 then
printCentered(80,"Level 2", white)
	if pad:cross() and oldpad:cross() ~= pad:cross() then
	dofile("Astroid_Escape/1_2.lua")
	end
end

if current == 3 and font_color <= 4 then
printCentered(90,"Level 3", blue)
	if pad:cross() and oldpad:cross() ~= pad:cross() then
	dofile("Astroid_Escape/1_3.lua")
	end
end

if current == 3 and font_color > 4 then
printCentered(90,"Level 3", white)
	if pad:cross() and oldpad:cross() ~= pad:cross() then
	dofile("Astroid_Escape/1_3.lua")
	end
end

if current == 4 and font_color <= 4 then
printCentered(130,"Level 1", blue)
	if pad:cross() then
	dofile("Astroid_Escape/2_1.lua")
	end
end

if current == 4 and font_color > 4 then
printCentered(130,"Level 1", white)
	if pad:cross() then
	dofile("Astroid_Escape/2_1.lua")
	end
end

if current == 5 and font_color <= 4 then
printCentered(140,"Level 2", blue)
end

if current == 5 and font_color > 4 then
printCentered(140,"Level 2", white)
end

if current == 6 and font_color <= 4 then
printCentered(150,"Level 3", blue)
end

if current == 6 and font_color > 4 then
printCentered(150,"Level 3", white)
end

if current == 7 and font_color <= 4 then
printCentered(190,"Level 1", blue)
end

if current == 7 and font_color > 4 then
printCentered(190,"Level 1", white)
end

if current == 8 and font_color <= 4 then
printCentered(200,"Level 2", blue)
end

if current == 8 and font_color > 4 then
printCentered(200,"Level 2", white)
end

if current == 9 and font_color <= 4 then
printCentered(210,"Level 3", blue)
end

if current == 9 and font_color > 4 then
printCentered(210,"Level 3", white)
end

if font_color > 8 then
font_color = 0
end

if current == 0 then
current = 9
end

if current == 10 then
current = 1
end

screen.waitVblankStart()
screen:flip()
oldpad = pad
end