Wednesday, 25 March 2015

Creating a Main Menu for Our Game


For the game, we had to create a piece of code as part of the requirement. I also wanted to give our game a main menu, so I thought that it be most ideal if I headed in that direction. I want onto YouTube and watched a tutorial of how to script and make a main menu look good.

The final main menu.
As you can see from the image above I have created a main menu, There were many pieces of code and animations that went into it. There was also a particle effect. All of the buttons work, and they actually take the player into the game menu.


The menu as a scene.
The scene set up in unity looks fairly complex as it has so many elements running through it. The camera is attached to a canvas that it doesn't move. When you click on the buttons in the game it will take you into a new scene, though depending on which one you select, it will activate an animation where the menu will slide out and then a new menu will slide into the scene.

Controls panel.
There are several different panels in the game, one of them is the controls menu. This is one of the those animations, where the old menu will slide of screen and this one will appear on screen. This menu just gives  you a brief description of the controls, like how to move and how to shoot.

Highscore panel.
Another one is the high score, which updates when you get a better score than the previous player. We did not have enough time to add in the player prefabs to the line of code for the high score, so it wouldn't save the high score once you had left the game. It does however show it on game and if it is beaten, it will change to the new score.

Game over menu.
There is also a game over scene which is in a separate scene from the player dies and they are sent to this scene. All the backgrounds for the menus where created by rendering the models and then taking them into Photoshop, there, I went over them bringing out different pieces of light, giving it a backdrop and posing them. Once you have been destroyed in the game, you will be taken into this menu, where you can choose to go to the Main Menu or can replay the game again.

MenuManager script.
The menu manager script controls the menu and their transactions. As you can see from the piece of code it is fairly uncomplicated. This just gives the menus the freedom to roam between each other.

Menu script.
This controls just the menu, with it making sure that all the cameras stick to there positions and that the animations take place. This also has the animation taken into account for when the buttons are clicked and the menus move away.

On click selection to take you to other areas.
This area controls where the button takes you when you click on it with the help of the loadlevel script but has to be set up here. So if you click on the Start Game button, it will take you into game.

The animation that works with the menus.
I had to add an animator component which meant that the animation would take place. Again this would just be the button and menu leaving the screen and a new menu reappearing on screen.

The particle system that is present on the main menu.
I also created a partical system for the main menu, meaning that when the menu was left and observed, a sparkle would appear on the screen. This was great to put in because it meant that the menu wasn't just a picture, but it was coming to life. It made the menu interesting and it was something different.

The music that features on the main menu.
I added a audio source which meant that we had music playing throughout. We grabbed an audio file that we had and placed it in the menu. When you went into the game, the sound changed and you got a more adrenaline pumping song, suiting the game.

The levelload script.
The leveload script allowed the transaction between the levels meaning you can start the game. This helped kickstart the game.

The mouseunlock script.
This unlocks the mouse so that the game allows you to use the mouse when the game ends. The mouse locks to the screen when you play the game as it controls where you shoot, so when you come back to the main menu, you need to use the mouse.


No comments:

Post a Comment