‫This video.
‫We'll have a look at how we can restart the game because so far we simply start the game by pressing
‫enter.
‫But now let's see how we can change that.
‫So as soon as our player drops.
‫And how do we find out if he drops?
‫Well, let's go ahead and create a request here or an if statement where we just check is transform
‫that position.
‫Thought why?
‫Lower than minus two.
‫Because if our player is lower than minus two, we want to end the game.
‫So game manager thought and game.
‫Now we don't have this method.
‫Of course we still need to create it.
‫Let's go to our game manager and create that method.
‫So let's do that here.
‫Public void end game is the name.
‫And what I want to have here is I want to open up the scene manager and in order to use the scene manager,
‫we need to implement or we need to add the namespace using unity engine scene management.
‫And now we can use the scene manager.
‫And what I want to do here is simply load the scene.
‫And if I enter zero, I will load the scene with the index of zero.
‫And in order to find out which scene has the index of zero, you can go to build settings.
‫And there you can find no scene because we haven't added any scenes.
‫And I will add open scenes, which is our main scene.
‫And here the right hand side, you can see the zero and a zero is our index that I have just entered.
‫So I could of course enter the name, but.
‫Adding the zero is fine as well.
‫So loads seen zero.
‫All right, so I will just reload the scene as soon as our player.
‫This guy here has a y value.
‫So let's go to the character.
‫All right?
‫Has a y y value of minus two.
‫So that means as soon as he is at this y value, I want to restart the game or end the game and reload
‫the scene.
‫So let's set them back to 0.5 and let's start the game again.
‫Let's see if all of that works.
‫So let's press enter to start the game, then let's walk a little bit, let's fall and we see our game
‫has been restarted or our scene has been restarted.
‫So let's start it again.
‫And we see our season has been restarted again.
‫And by the way, you might say, wow, this is this looks a little weird.
‫So let's start a game and let's fall down.
‫You see, it looks very different.
‫We have now this dark set up and that is just with unity.
‫That's something that happens with unity as soon as we built this game.
‫So let's go to file, build and run, and we built that game somewhere.
‫So I'm going to build it in the exact clone.
‫I'm going to call the Zig Zag clone game.
‫Let's save that.
‫That will now take a little while and now it's done and I can find it within my the exact clone folder
‫where I saved it.
‫So I'm going to open the clone app.
‫I'm going to start it in full HD Now let's play the game.
‫Made with unity.
‫That's awesome.
‫So that we are our guy.
‫He's animating.
‫Let's press enter.
‫He's walking, we fall.
‫And there you are.
‫You see, it looks exactly the same as before, so our level still looks great.
‫All right, so in the next video, we are going to have a look at crystals and how we can collect them
‫and how we can add score.