This Code was not made by me it was made by ARza
-- Simple Menu
--BY: ARza
--Colors
white = Color.new(255,255,255)
red = Color.new(255,0,0)
current = 1 --this is our current menu selection
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
-- Prints our 5 menu options
screen:print(240,100,"Start",white)
screen:print(240,110,"Options",white)
screen:print(240,120,"High Scores",white)
screen:print(240,130,"Cheats",white)
screen:print(240,140,"Exit",white)
-- These make it so when the variable "current" changes
-- so does the current menu selection
if current == 1 then
screen:print(240,100,"Start",red)
end
if current == 2 then
screen:print(240,110,"Options",red)
end
if current == 3 then
screen:print(240,120,"High Scores",red)
end
if current == 4 then
screen:print(240,130,"Cheats",red)
end
if current == 5 then
screen:print(240,140,"Exit",red)
end
-- 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
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current + 1
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
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
-- To make the menu work you just need to add a few
-- if/then statements. For example
--if pad:cross() and current == 1 then
--Start()
--end
-- This will make it so if "Start" is highligted and
-- you press Cross then it will do the function Start()
If you would like to submit your own code contact me at
[email protected]
-- Simple Menu
--BY: ARza
--Colors
white = Color.new(255,255,255)
red = Color.new(255,0,0)
current = 1 --this is our current menu selection
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
-- Prints our 5 menu options
screen:print(240,100,"Start",white)
screen:print(240,110,"Options",white)
screen:print(240,120,"High Scores",white)
screen:print(240,130,"Cheats",white)
screen:print(240,140,"Exit",white)
-- These make it so when the variable "current" changes
-- so does the current menu selection
if current == 1 then
screen:print(240,100,"Start",red)
end
if current == 2 then
screen:print(240,110,"Options",red)
end
if current == 3 then
screen:print(240,120,"High Scores",red)
end
if current == 4 then
screen:print(240,130,"Cheats",red)
end
if current == 5 then
screen:print(240,140,"Exit",red)
end
-- 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
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current + 1
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
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
-- To make the menu work you just need to add a few
-- if/then statements. For example
--if pad:cross() and current == 1 then
--Start()
--end
-- This will make it so if "Start" is highligted and
-- you press Cross then it will do the function Start()
If you would like to submit your own code contact me at
[email protected]