blue = Color.new(56,172,236)

itemlist = 0
startbox = Image.load("startbox.png") 
selector = Image.load("selector.png")
statpage = Image.load("statpage.png")

s = 1
statpg = 0

counter = 0
selectory = 15
while s ==1 do
pad = Controls.read()
screen:blit(370,0,startbox)
screen:blit(380,selectory,selector)
screen:print(398, 23, "POKEMON")
screen:print(398,43, "ITEMS")
screen:print(398,63, "SAVE")
screen:print(398,83, "EXIT")
counter = counter + 1

if pad:down() and oldpad:down() ~=pad:down() and selectory < 75 then
	selectory = selectory + 20
end
if pad:up() and oldpad:up() ~= pad:up() and selectory > 15 then
	selectory = selectory -20
end
if pad:l() and oldpad:l() ~=pad:l() then
s = 0
end




if pad:r() and oldpad:r() ~= pad:r() and selectory == 35 and counter >=3 then
itemlist = 1
counter = 0
dofile("./itemlist.lua")
end


if pad:r() and oldpad:r()~= pad:r() and selectory == 75 then
s = 0
end
if pad:r() and oldpad:r() ~= pad:r() and selectory == 15 then
statpg =1
end
if pad:r() and selectory == 55 then
screen:blit(71,170, textbox)
screen:print(101,190, "SAVING.....", blue)
dofile("./savedata.lua")
screen:blit(71,170, textbox)
screen:print(101, 190, "DONE")
if pad:r() and oldpad:r() ~= pad:r() then
	s = 0
end
end
if statpg ==1 then
screen:blit(0,0,statpage)
screen:print(52, 62, pokemon[1].name , blue)
screen:print(59,79, pokemon[1].C_HP, blue)
screen:print(85,79, "/", blue)
screen:print(100, 79, pokemon[1].MAX_HP, blue)
screen:print(240, 30, pokemon[2].name .. "     lv" .. pokemon[2].lv .. "   HP   " ..pokemon[2].C_HP .. "/" .. pokemon[2].MAX_HP, blue)
screen:blit(133, 70, pokemon[1].pic)
if pad:l() then
	statpg = 0
end
end
screen.waitVblankStart()
screen.flip()



oldpad = pad
screen:print(0,0, selectory)
end