Making a menu?

BlitzMax Forums/BlitzMax Beginners Area/Making a menu?

Captain Wicker (crazy hillbilly)(Posted 2012) [#1]
Hi,

I was looking to add a title menu and other menuey type things into my game, I've never created a menu before. What are some simple methods for creating selectable title menus etc??



Thanks in Advance! :D

Last edited 2012


DaY(Posted 2012) [#2]
one of the easier ways is to detect if the mouse is over the image and swap images over depending if it is or not.

i.e.

If mousex > imagepos
showimage mouseover.png
else
showimage mousenotover.png
endif

you would only need to track the mouse cordinates and soon as it goes into the zone thats when you change it over you could even add sound effects.

The other way is to use Sprite Collision were you replace the mouse cursor with a custem one and run checks and do the changes when collision is recorded.

the first is pretty fast and reliable as i have used it in a few diff languages i have not tried the second but i know alot use that method.


Arska(Posted 2012) [#3]
For my game, i made simple menu where you can move with arrow keys.

If menuSelected<2 And KeyHit(key_down) Then menuSelected=menuSelected + 1
If menuSelected>1 And KeyHit(key_up) Then menuSelected=menuSelected - 1
		
		
DrawImage (menuRG, GraphicsWidth()/2-140, GraphicsHeight()/2-20,560/2 ,80/2)
DrawImage (menuQG, GraphicsWidth()/2-140, GraphicsHeight()/2+50,560/2 ,80/2)
		
If menuSelected=1 Then 
	DrawImage (menuRGSel, GraphicsWidth()/2-140, GraphicsHeight()/2-20,560/2 ,80/2)

	If KeyHit(key_return) Then menu=False
EndIf
		
If menuSelected=2 Then 
	DrawImage (menuQGSel, GraphicsWidth()/2-140, GraphicsHeight()/2+50,560/2 ,80/2)
	If KeyHit(key_return)Then 

		End

	EndIf
EndIf



Here is 2 buttons. Resume game and Quit game.