Wednesday, April 5, 2017

Day 31: Audio-only Game, Post 6

First of all, I decided to make the 'settings' button work. I simply set the button to change the settings panel to "active", which makes the panel appear.

I then went to the "back" button on the settings panel, and set that to change the settings panel to "inactive"

Now I can show and hide the settings panel.

Now to set the "escape" key to show the main menu, or hide all menus. First of all, I added a boolean called "EscapeActivated" When it is 'true' the main menu will appear. When it changes to false, all menus will disappear (if the player is in-game).
Then, after a bit of experimentation and googling, I added some code that toggles the boolean whenever the escape key is pressed.

I ended up running into a problem. When I put the script on one of the menus, it won't work, because at some point the menu will be deactivated, and the script with it.

So what I'll need to do next class is make a new empty game object, and put the script on that and have the script remotely activate/deactivate the menus from there.

No comments:

Post a Comment