Beta comes…
|
The last week I have been working on amongst others creating the code for navigating the main menu(as well as any other menus I hope). I did not copy any code from others except for some simple code that did exactly what I wanted. The code is simple and inelegant but it seems to work for now(the last picture is the menu with the red circle being the cursor, can’t really show how it works in images alone). The code works by using a number to represent what the current selection is, then based on that number when enter is pressed, a certain thing happens(start the game, go to the options or exit for example). When the down key is pressed the selection number increases and if it’s at the highest number(the last selection, in this case exit) it goes back to one. The cursor is also moved with the selection showing what the player has selected right now. If up is pressed the process is reversed, the number decreases and if at one goes to five(we have planned five options to select on the main menu, start, options, highscore, credits and exit). When enter is pressed the program looks at what selection number it currently is at and from that chooses what to do next. The program also includes a timer that keeps it from reacting to the same button press several times and is simply a float value decreased by the difference in time since last time every update and every time up or down is pressed the program checks if the timer is below or equal to zero and if it is it does what it I described above, otherwise it does nothing, and when it has done anything it sets the time to 0.2 so that for about that many seconds pressing the down or up button does nothing(this time is barely noticeable but without it the program freaks out every time up or down is pressed). The reason I wrote this code is because we have planned to not have any mouse controls at all and to have the player press a button on the keyboard is a bit silly(press G to start was the previous method). A menu interface like this is a classic, so many people would recognise it and those who do not should quickly enough figure it out or get help easily enough. This type of interface also shows all the different selections clearly and only requires three buttons to operate.
|


