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