x


'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.

more ▼

asked May 16 '11 at 04:12 PM

Johnton gravatar image

Johnton
1 1 1 3

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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); }
more ▼

answered May 16 '11 at 04:53 PM

Jonathan Beer gravatar image

Jonathan Beer
1 3

Cheers dude. How would I go about creating the 'Game Over or Mission Complete' screen, GUI wise...?

May 16 '11 at 05:04 PM Johnton
(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered May 16 '11 at 05:28 PM

Scribe gravatar image

Scribe
1.4k 12 16 34

Thanks a lot. Will give it a give now.

May 16 '11 at 05:42 PM Johnton
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3694
x1175
x535
x243
x17

asked: May 16 '11 at 04:12 PM

Seen: 2621 times

Last Updated: May 16 '11 at 04:53 PM