Game Development Reference
In-Depth Information
//Creating the enum parameter for the menu page
enum Page { GAMEOVER, LOCALSCORE, SERVERSCORE };
//Creating the enum parameter for the menu page
private var e_page : Page = Page.GAMEOVER;
//Creating the scroll position for the local high score scroller
area
private var scrollPositionL : Vector2 = Vector2.zero;
//Creating the scroll position for the server high score scroller
area
private var scrollPositionS : Vector2 = Vector2.zero;
//Checking if the restart button is clicked by the user
private var b_isClickRestart : boolean = false;
//Checking if the submit button is clicked by the user
private var b_isClickSubmit : boolean = false;
2. Next, set up the default value for our parameters by adding the following script to
the Start() funcion:
public function Start() : void {
//Initializing
e_page = Page.GAMEOVER;
scrollPosition = Vector2.zero;
b_isClickRestart = false;
b_isClickSubmit = false;
}
3. Coninue to the next funcion OnGUI() ; we will add more script here to create our
GAMEOVER menu page. So let us add the highlighted script as follows:
public function OnGUI() : void {
if (StaticVars.b_isGameOver) {
GUI.skin = customSkin;
//Checking if we didn't click on the restart button
if (b_isClickRestart == false) {
//Checking for the current page
switch (e_page) {
case Page.GAMEOVER:
GameoverPage(); //Creating game over page
break;
case Page.LOCALSCORE:
LocalScorePage(); //Creating local score page
 
Search WWH ::




Custom Search