I have a problem with my menu.
Basically i have an image with three options on it, and i have an image for an arrow to display which one is highlighted.
I can and have the code for just the arrow to move between each option by pressing up/down, but i want to go a bit more advanced. i want the arrow to move slightly from side to side like
in first half second
->
2nd:
. ->
3rd
... -> [ignoring the full stops]
and back then and repeat that.
so i made a nother integer , arrow1 (one signifying that it's highlighting the 1st option) and thin int can be 1,2 or 3 which displays it moving.
Only problem is it doesnt work, the menu gets glitchy and gets linely in places
PHP-Code:
oldpad = Controls.read()
screen:clear()
menu = Image.load("menu.png")
arrow = Image.load("arrow.jpg")
intmenu = 1
while true do
pad = Controls.read()
if pad:down() and oldpad:down() ~= pad:down() then
intmenu = intmenu + 1
end
if pad:up() and oldpad:up() ~= pad:up() then
intmenu = intmenu - 1
end
if intmenu >= 4 then
intmenu = 1
end
if intmenu <= 0 then
intmenu = 3
end
if intmenu == 1 then
arrow1 = 1
screen.waitVblankStart(3)
arrow1 = arrow1 + 1
if arrow1 >= 4 then
arrow1 = 1
end
if arrow1 <= 0 then
arrow1 = 3
end
if arrow1 == 1 then
screen:clear()
screen:blit(0, 0, menu)
screen:blit(3, 105, arrow)
end
if arrow1 == 2 then
screen:clear()
screen:blit(2, 105, arrow)
end
if arrow1 == 3 then
screen:clear()
screen:blit(1, 105, arrow)
end
screen:flip()
if pad:cross() then
dofile("character.lua")
end
end
if intmenu == 2 then
screen:clear()
screen:blit(0, 0, menu)
screen:blit(3, 172, arrow)
if pad:cross() then
dofile("credits.lua")
end
end
if intmenu == 3 then
screen:clear()
screen:blit(0, 0, menu)
screen:blit(3, 240, arrow)
if pad:cross() then
dofile("credits.lua")
end
end
screen:flip()
oldpad = pad
end
I've only tried it for the first option, i hope to have arrow2 and 3 ints if i can get the 1st one to work
I have a feeling that i have a blit in the wrong places but tried different ways and didnt work properly
Anyone see a problem(s)??