Basic Menu principles by MikeS23rd Nov 2003 12:01
|
---|
Summary This is a simple way of doing a main menu for your game. The same principles are applied for detection of other objects on the 2D screen. Description This is a simple way of doing a main menu for your game. The same principles are applied for detection of other objects on the 2D screen. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `This snippet was made by Yellow(mike) `Credit would be nice if used for freeware/commercial/shareware/etc. `Though credit would be nice, it's not necessary. `Created 11/23/03 `Hope this helps you with basic menu functions `The same principles are applied to spries/plains/etc. `This sets up the program sync on : sync rate 60 backdrop on set text size 24 ink rgb(255,255,255),1 do `These two commands are very helpful for getting the 2D positions of the mouse cursor set cursor 0,30 print mousex() print mousey() `This is the position of the current button text 0,0,"test" `The first statement tells us that if the mouse cursor x position is between 0 and 40 `and the mouse cursor y position is between 0 and 30, the color of the text will change. if mousex()>=0 and mousex()<=40 and mousey()>=0 and mousey()<=30 ink rgb(255,0,0),1 text 0,0,"test" ink rgb(255,255,255),1 `This statement does the same as the above, except it checks for a mouseclick if mousex()>=0 and mousex()<=40 and mousey()>=0 and mousey()<=30 and mouseclick()=1 text 0,0,"test button was clicked" `For now, I've only added that text was clicked. This can be replaced with other things. `Example: gosub level1(or whatever you want to call when this button is clicked endif endif sync loop |