|
Hi dudes, I am designing a game with 3 Levels for example if we have 10 enemies in our first level and once its completed we have to switch to the next level and so on. Here my doubt is in coding part once i complete my task by destroying my enemies in Level 1 how can jump to next level in this also i can load my next level by using "Application.LoadLevel("name of scene")" but the thing is how to identify that my enemies are destroyed and to loaded the next level automatically Please help me
(comments are locked)
|
|
hey, Do you have all those levels in different scenes. if you have it as different scenes means first add all those scenes when you build the project. when you hit build it shows a button name as ADD CURRENT.first you just hit it and add all those levels of your project.after you add this it'll appear like this, Scene1 Name - 0 Scene2 Name - 1 Scene3 Name - 2 you'll get like this,if you want to move 2nd scene after killing those enemies means just use Application.LoadLevel(1), and move 3rd scene means use Application.LoadLevel(2). see this link http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevel.html if you're not using different scene you cant use Application.LoadLevel. Simple and enjoy. Thank you Buddy ! My doubt is that how to detect that my enemies are destroyed so that once its detected it has to load next level
Apr 05 '11 at 07:01 AM
guru
just use counts....consider you're having 10 enemies when game get start...decrease that count when enemies destroy...finally if you got count 0 means move to next level...thats it...easy to make the code...
Apr 06 '11 at 08:39 AM
sriram90
(comments are locked)
|
This function loads level by its index. You can see the indices of all levels using the File->Build Settings... menu in Unity. Before you can load a level you have to add it to the list of levels used in the game. Use File->Build Settings... in Unity and add the levels you need to the level list there. Thank you Buddy ! My doubt is that how to detect that my enemies are destroyed so that once its detected as my enemies in level 1 are completely destroyed it has to load next level
Apr 05 '11 at 07:03 AM
guru
(comments are locked)
|
|
Well, in order to detect when all the enemies are destroyed (in order to load the next level), you'll need to keep some kind of counter to keep track of how many enemies are left. That way, when the counter reaches zero, you know you have no enemies left, and you can advance to the next level. I recently gave an answer to a very similar question here. Since the script is almost exactly what you need, just replace "cannon" with "enemy" and you should be good to go. Oh, and you'll also need a way to keep track of what level you're on, so you that you can advance to the next one. Thank you Elliot Let me try with this and if i have any doubt i will get back to you .
Apr 05 '11 at 07:04 AM
guru
(comments are locked)
|
