gunntims0103
November 10th, 2006, 17:00
i rather not put out the code that iv done out like this but i need help as i keep getting an error with my menu.lua for sora adventure. It keeps saying attempt to global 'LoadA' but there seems to be nothing wrong. can anyone help heres the code below
status = "menu"
Black = Color.new(0, 0, 0)
Red = Color.new(255, 0, 0)
--load images--
Background = Image.load("backgrounds/menu.png")
--load files--
LoadA = loadfile("scene.lua")
LoadB = loadfile("instructions.lua")
LoadC = loadfile("credits.lua")
while true do
current = 1
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
----prints to the screen-------
screen:blit(0, 0, Background)
screen:print(185, 175, "Start Game", Black)
screen:print(185, 195, "Instructions", Black)
screen:print(185, 215, "Credits", Black)
screen:print(314, 263, "Press Home to exit", Black)
screen:print(320, 4, "Gunntims0103-Coder", Black)
-----this code is so that when you highlight an option in a menu it turns red-----
if current == 1 then
screen:print(185, 175, "Start Game", Red)
end
if current == 2 then
screen:print(185, 195, "Instructions", Red)
end
if current == 3 then
screen:print(185, 215, "Credits", Red)
end
-----this makes it so that you can scroll through your menu----
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
if current == 4 then
current = 1
end
if current == 0 then
current = 3
end
-----this is to select your menu options------
if pad:cross() and current == 1 then
LoadA()
end
if pad:cross() and current == 2 then
LoadB()
end
if pad:cross() and current == 3 then
LoadC()
end
screen.waitVblankStart()
screen:flip()
oldpad = pad
end
end
status = "menu"
Black = Color.new(0, 0, 0)
Red = Color.new(255, 0, 0)
--load images--
Background = Image.load("backgrounds/menu.png")
--load files--
LoadA = loadfile("scene.lua")
LoadB = loadfile("instructions.lua")
LoadC = loadfile("credits.lua")
while true do
current = 1
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
----prints to the screen-------
screen:blit(0, 0, Background)
screen:print(185, 175, "Start Game", Black)
screen:print(185, 195, "Instructions", Black)
screen:print(185, 215, "Credits", Black)
screen:print(314, 263, "Press Home to exit", Black)
screen:print(320, 4, "Gunntims0103-Coder", Black)
-----this code is so that when you highlight an option in a menu it turns red-----
if current == 1 then
screen:print(185, 175, "Start Game", Red)
end
if current == 2 then
screen:print(185, 195, "Instructions", Red)
end
if current == 3 then
screen:print(185, 215, "Credits", Red)
end
-----this makes it so that you can scroll through your menu----
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
if current == 4 then
current = 1
end
if current == 0 then
current = 3
end
-----this is to select your menu options------
if pad:cross() and current == 1 then
LoadA()
end
if pad:cross() and current == 2 then
LoadB()
end
if pad:cross() and current == 3 then
LoadC()
end
screen.waitVblankStart()
screen:flip()
oldpad = pad
end
end