Thursday, April 6, 2017

Day 32: Audio-only Game, Post 7

Today I will continue setting up the game menu. Last class, I moved the MenuController script to another game object to make it work. Now I just need it to deactivate/activate the menus remotely.

First of all, I decided to use tags to differentiate between different gamer objects. I added the tag "GameMenu" to the GameMenuPanel, and "Menu" to the other sub-menus.

Alright, I scrapped pretty much everything except for the "EscapeActivated" boolean, and added a single line of code: "GameMenuPanel.SetActive (EscapeActivated);"

And it works.

Now all I need to do is apply it to the other menus. They will now all deactivate when the escape button is pressed.

Testing it out:

I also quickly added a "resume" button in the 'Paused' menu. Unfortunately, I can't make the button change the "EscapeActivated" boolean, which means you have to press escape to change it to false, then escape again to change it to true to activate the menu.

Next class I will make the "escape" button actually pause the game. Right now, it just shows the menu and doesn't actually pause the game.





























No comments:

Post a Comment