Sunday, 18 December 2016

YEAR 3 - BA3a - SpaceNinja - NEW menus

I'm  in the process of creating new menus that can be controlled with keyboard/ controller because when testing the game at the NIGD it was annoying to have to constantly stand up to use the mouse every time I wanted to manually make a change to the level (or change the debug options like changing the number of double jumps or hover time) (If you want to test this yourself, it's just the number keys on the right hand side of the keyboard when numlock is turned on)

It's proving more difficult than I originally thought but I've figured out a way to get it to work pretty well now.
Essentially, I make all the menu buttons into the same class (called 'menuButtons'), and place them into the room from top to bottom. I then have a piece of code that counts the number of menuButtons in the room, creates an array of that length and orders them in the array in the order that they were created. Then, I make the up down controller/keyboard buttons move forwards and backwards through the array and 'activate' which ever button is at the current part of the array. Then when the player presses 'A' (controller)/'Z' (keyboard) it 'uses' the currently activated button.

However, it's taking quite a while to do this for each room so I only have it fully working on the first room. It gets even more complicated when I want menus within menus because I have to change the array that is currently being edited by the player . Essentially though, this is the first thing I'm going to finish off once we start the new term.


No comments:

Post a Comment