1 00:00:04,010 --> 00:00:04,490 ‫This video. 2 00:00:04,490 --> 00:00:09,620 ‫We'll have a look at how we can restart the game because so far we simply start the game by pressing 3 00:00:09,620 --> 00:00:10,210 ‫enter. 4 00:00:10,220 --> 00:00:12,770 ‫But now let's see how we can change that. 5 00:00:12,770 --> 00:00:16,610 ‫So as soon as our player drops. 6 00:00:16,610 --> 00:00:18,840 ‫And how do we find out if he drops? 7 00:00:18,860 --> 00:00:26,330 ‫Well, let's go ahead and create a request here or an if statement where we just check is transform 8 00:00:26,330 --> 00:00:27,920 ‫that position. 9 00:00:28,220 --> 00:00:29,240 ‫Thought why? 10 00:00:30,150 --> 00:00:31,710 ‫Lower than minus two. 11 00:00:31,890 --> 00:00:37,260 ‫Because if our player is lower than minus two, we want to end the game. 12 00:00:37,260 --> 00:00:42,590 ‫So game manager thought and game. 13 00:00:43,140 --> 00:00:44,370 ‫Now we don't have this method. 14 00:00:44,370 --> 00:00:46,370 ‫Of course we still need to create it. 15 00:00:46,380 --> 00:00:49,080 ‫Let's go to our game manager and create that method. 16 00:00:49,710 --> 00:00:51,420 ‫So let's do that here. 17 00:00:51,870 --> 00:00:58,020 ‫Public void end game is the name. 18 00:00:58,020 --> 00:01:05,010 ‫And what I want to have here is I want to open up the scene manager and in order to use the scene manager, 19 00:01:05,010 --> 00:01:12,900 ‫we need to implement or we need to add the namespace using unity engine scene management. 20 00:01:13,200 --> 00:01:15,960 ‫And now we can use the scene manager. 21 00:01:18,090 --> 00:01:21,390 ‫And what I want to do here is simply load the scene. 22 00:01:21,390 --> 00:01:27,960 ‫And if I enter zero, I will load the scene with the index of zero. 23 00:01:27,960 --> 00:01:34,500 ‫And in order to find out which scene has the index of zero, you can go to build settings. 24 00:01:36,610 --> 00:01:41,170 ‫And there you can find no scene because we haven't added any scenes. 25 00:01:41,170 --> 00:01:44,350 ‫And I will add open scenes, which is our main scene. 26 00:01:44,350 --> 00:01:49,600 ‫And here the right hand side, you can see the zero and a zero is our index that I have just entered. 27 00:01:49,600 --> 00:01:52,900 ‫So I could of course enter the name, but. 28 00:01:54,100 --> 00:01:55,540 ‫Adding the zero is fine as well. 29 00:01:55,540 --> 00:01:57,010 ‫So loads seen zero. 30 00:01:59,080 --> 00:02:03,190 ‫All right, so I will just reload the scene as soon as our player. 31 00:02:03,880 --> 00:02:06,730 ‫This guy here has a y value. 32 00:02:07,090 --> 00:02:08,500 ‫So let's go to the character. 33 00:02:08,500 --> 00:02:08,850 ‫All right? 34 00:02:08,870 --> 00:02:11,260 ‫Has a y y value of minus two. 35 00:02:11,260 --> 00:02:18,070 ‫So that means as soon as he is at this y value, I want to restart the game or end the game and reload 36 00:02:18,070 --> 00:02:18,790 ‫the scene. 37 00:02:19,060 --> 00:02:24,070 ‫So let's set them back to 0.5 and let's start the game again. 38 00:02:24,430 --> 00:02:26,590 ‫Let's see if all of that works. 39 00:02:26,590 --> 00:02:32,980 ‫So let's press enter to start the game, then let's walk a little bit, let's fall and we see our game 40 00:02:32,980 --> 00:02:36,340 ‫has been restarted or our scene has been restarted. 41 00:02:36,970 --> 00:02:38,380 ‫So let's start it again. 42 00:02:40,060 --> 00:02:42,910 ‫And we see our season has been restarted again. 43 00:02:44,620 --> 00:02:48,730 ‫And by the way, you might say, wow, this is this looks a little weird. 44 00:02:48,730 --> 00:02:51,310 ‫So let's start a game and let's fall down. 45 00:02:51,340 --> 00:02:53,140 ‫You see, it looks very different. 46 00:02:53,140 --> 00:02:57,010 ‫We have now this dark set up and that is just with unity. 47 00:02:57,010 --> 00:03:00,550 ‫That's something that happens with unity as soon as we built this game. 48 00:03:00,550 --> 00:03:07,420 ‫So let's go to file, build and run, and we built that game somewhere. 49 00:03:07,420 --> 00:03:10,000 ‫So I'm going to build it in the exact clone. 50 00:03:10,000 --> 00:03:15,880 ‫I'm going to call the Zig Zag clone game. 51 00:03:16,330 --> 00:03:17,260 ‫Let's save that. 52 00:03:21,310 --> 00:03:29,260 ‫That will now take a little while and now it's done and I can find it within my the exact clone folder 53 00:03:29,260 --> 00:03:30,070 ‫where I saved it. 54 00:03:30,070 --> 00:03:32,110 ‫So I'm going to open the clone app. 55 00:03:32,350 --> 00:03:35,710 ‫I'm going to start it in full HD Now let's play the game. 56 00:03:37,810 --> 00:03:39,120 ‫Made with unity. 57 00:03:39,130 --> 00:03:39,910 ‫That's awesome. 58 00:03:39,910 --> 00:03:41,920 ‫So that we are our guy. 59 00:03:42,040 --> 00:03:43,060 ‫He's animating. 60 00:03:43,060 --> 00:03:44,080 ‫Let's press enter. 61 00:03:44,080 --> 00:03:45,580 ‫He's walking, we fall. 62 00:03:45,580 --> 00:03:46,930 ‫And there you are. 63 00:03:47,020 --> 00:03:52,720 ‫You see, it looks exactly the same as before, so our level still looks great. 64 00:03:54,220 --> 00:03:59,350 ‫All right, so in the next video, we are going to have a look at crystals and how we can collect them 65 00:03:59,350 --> 00:04:00,820 ‫and how we can add score.