- Home /
can someone make script that when i lost my lives in game to back me to the main menu??!?
Don't post duplicate questions. I deleted the other two for you.
Answer by Screenhog · Aug 16, 2012 at 04:03 PM
Are you keeping track of lives as a variable? You should be. Whenever you lose a life somewhere, you should be calling a function that tests whether your number of remaining lives is 0. If it is, Application.LoadLevel ("MainMenu").
But can you make when someone clicl "Esc=Escape" button to back it to something like "Go to mainmenu " or "Resume Game" please? :)
Answer by Aranhawebs · Aug 16, 2012 at 07:48 PM
I suppose that you have two scenes. The scene of the game and the scene of the Main Menu. You can put in the Update Method to If the variable "playerLives" reach to Zero. you call Application.LoadLevel ("MainMenu");
I have two scenes and first is main menu...i click play game..and run my game i kill what i make and nothing happens any more..of if i come to one live the keep killing me and nothing...can you help me ? can you make script for me that you say Andeson Santos playerLives pleasE?!
Answer by Aranhawebs · Aug 17, 2012 at 02:55 AM
Is something like that...
If (playerLives == 0) {
Application.LoadLevel ("MainMenu");
}
...you will put this into Update method.
Public void Update () or function Update ()
Answer by Benjamin6817 · Aug 17, 2012 at 06:32 AM
Well, you would do something like this for a JavaScript:
function Update() {
Application.LoadLevel("Main Menu");
}
And you would replace 'Main Menu' with whatever the name of you main menu level was.
Same with C#, only it would look like this
using UnityEngine; using System.Collections.Generic;
class GoToMainMenu() { void Update() { Application.LoadLevel("Main Menu"); } }
Also, replace GoToMainMenu with the name of the script and, replace Main Menu with the name of your level.
Don't forget to add both levels when you build the application, although it should work fine in the editor.
name of the scene is $$anonymous$$ain$$anonymous$$enu and first script will do just fine...thanks :) But can you make when someone clicl "Esc=Escape" button to back it to something like "Go to mainmenu " or "Resume Game" please? :)
Your answer
Follow this Question
Related Questions
How can i find to Cool Main menu for iOS 1 Answer
elastic scrolling scripting 0 Answers
Main Menu Script Issues 1 Answer
How to have music not restart between scenes? 1 Answer
Script to start another object 2 Answers