--Colors
white = Color.new(255,255,255)
red = Color.new(255,0,0)
level1 = Image.load("mapimg/level1.png")
level2 = Image.load("mapimg/level2.png")
bgi = Image.load("mapimg/bgi.png")
box = Image.load("mapimg/box.png")
word = Image.load("mapimg/word.png")
cs = Image.load("mapimg/cs.png")
qg = Image.load("mapimg/qg.png")
click = Sound.load("sound/click.wav",false)
pic = Sound.load("sound/pic.wav", false)
monkey = Image.load("images/monkey.png")
bgs = Sound.load("sound/intros.wav", true)
Music.volume(128)

local sound = bgs
voice = sound:play()

current = 1 --this is our current menu selection
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
screen:blit(0,0,bgi, true)
screen:blit(270,100,word, true)
-- These make it so when the variable "current" changes
-- so does the current menu selection
if current == 1 then
screen:blit(55,50,level1, true)
end
if current == 2 then
screen:blit(55,50,level2, true)
end
if current == 3 then
screen:blit(55,50,cs, true)
end
if current == 4 then
screen:blit(55,50,cs, true)
end
if current == 5 then
screen:blit(55,50,qg, true)
end
-- Prints our 5 menu options
screen:print(20,180,"Death Match",white)
screen:print(20,190,"Capture the Flag",white)
screen:print(20,200,"map3",white)
screen:print(20,210,"map4",white)
screen:print(20,220,"Exit",white)
if current == 1 then
screen:print(20,180,"Death Match",red)
end
if current == 2 then
screen:print(20,190,"Capture the Flag",red)
end
if current == 3 then
screen:print(20,200,"map3",red)
end
if current == 4 then
screen:print(20,210,"map4",red)
end
if current == 5 then
screen:print(20,220,"Exit",red)
end

screen:blit(54,49,box, true)
-- Makes it so when UP/DOWN is pressed, the variable
-- "current" changes making the selection change
if pad:up() and oldpad:up() ~= pad:up() then
current = current - 1
click:play()
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current + 1
click:play()
end
--Makes it so the selection goes from the bottom to top
if current == 6 then
current = 1
end
if current == 0 then
current = 5
end
if pad:cross() and current == 1 then
voice:stop()
pic:play()
dofile("./game.lua")
end
if pad:cross() and current == 2 then
voice:stop()
pic:play()
dofile("./flag.lua")
end
if pad:cross() and current ==5 then
os.exit() 
end
screen:blit(446,227,monkey, true)
screen.waitVblankStart()
screen.flip()
oldpad = pad
if pad:select() then screen:save("screenshot.jpg") end
end
-- To make the menu work you just need to add a few
-- if/then statements. For example




-- This will make it so if "Start" is highligted and 
-- you press Cross then it will do the function Start()
