- Home /
'Mission Complete/Game Over' screen once objective is complete.
I'm VERY new to using unity and would like guidance/assistance on how to create a 'GAME OVER' screen once objective is complete which is for the player to shoot down all enemy targets.
I have some knowledge on using gui, not much. Real problem is lack of coding integration, so would be great if I can get some help and how would I go about linking the 'GAME OVER' screen prior to objective being met.
Cheers.
Answer by Jonathan Beer · May 16, 2011 at 04:53 PM
Personally, I use this collider script - I'm doing a platformer though, so it'll be for touching the last platform.
function OnTriggerEnter(hit:Collider) { if(hit.gameObject.tag=="Player") Application.LoadLevel(2); }
Cheers dude. How would I go about creating the 'Game Over or $$anonymous$$ission Complete' screen, GUI wise...?
I am very sorry if any scripting is wrong in my answer but I am away from my main computer (with unity installed)
the above answer would change the level when the player collides with something once which, unless you only have one enemy that gets stronger each level probably isn't what you need.
I would suggest doing something along these lines:
var targetTag = "enemy";
function Update () {
if(GameObject.FindWithTag(targetTag) == null){
print("none left");
Application.LoadLevel ("GameOver");
}
else{
print("enemies left");
}
}
you will probably get an error message as you have no scene called GameOver and have not built your game so you should add the Application.LoadLevel ("GameOver"); line after creating the GameOver level
hope that helps
Scribe
Your answer
Follow this Question
Related Questions
Player Fast Travels 1 Answer
Camera focusing on an object specified in a script 1 Answer
UFPS:ultimate fps cameraGUI texture wont show in game 0 Answers
Cube Counter 1 Answer
My monster only choose one Target 2 Answers