Navigating menus

Blitz3D Forums/Blitz3D Beginners Area/Navigating menus

Hmm, i'v tried a number of things to get the effect of navigation menus, none really work i get a MAV error with some, some just don't work, so how would you do it?

this is how i'm doing it:
i call this at the top of the code before everything else (after apptitle)

Global selection=1
If selection=1 Mainmenu()
If selection=2 options()


these are the funtions, it breaks the loop and goes to the main program when you click the play button, i didnt have enough time to make myself a options button, so i make the [1] key (up top not numberpad) the key to go to the options screen

heres the functions:

Mainmenu()

Function Mainmenu()
Graphics 800,600,32,2


mainimage=LoadImage("mainmenu.png")
continue=LoadImage("Playbutton.png")
;mouse=LoadImage("mouse.png")
MaskImage continue,255,0,255



While selection=1
;mouse_x=MouseX()
;mouse_y=MouseY()
Cls


DrawImage mainimage,0,0
DrawImage continue,100,400
;DrawImage mouse,mouse_x,mouse_y
Flip

If ImageRectCollide(continue,100,400,0,MouseX(),MouseY(),5,5) And MouseHit(1)
selection=2
End If

If KeyHit(1)
End
End If

If KeyHit(2)
selection=3
End If

Delay 5
Wend

End Function


options()
Function options()
Graphics 800,600,32,2

Backbutton=LoadImage("Backbuttons.png")

DrawImage backbutton,0,0

While selection=3

If ImageRectCollide(backbutton,0,0,0,MouseX(),MouseY(),5,5) And MouseHit(1)
selection=1
End If


If KeyHit(1)
End
End If

Delay 5
Wend

End Function


its works, but when i go to the options screen and click on the back button its SUPPOST to go back to the main menu, but it goes to the game insted...

I'd like to hear your menu tips and of course how you do it.