‫Welcome to the Project Outline and this video.
‫I'm going to show you the end result of this chapter and I'm going to tell you how you can build this.
‫I'm just going to do it real quick.
‫I don't want to go into too much detail because you should be able to try to build that game yourself.
‫By now, you have learned most of the things that you need here, and if there is something missing,
‫then you can of course use the documentation.
‫Or if you get stuck, you can watch the following videos in which I explain everything step by step.
‫And if you don't feel like trying it yourself, of course you can go ahead and follow along to videos
‫anyways.
‫All right.
‫So let's have a quick look at what we have here.
‫So we have multiple different scenes.
‫We have a game scene, a game over scene, and the main menu and the game scene is the one that we have
‫open here, which consists of the field, which has all of those components like balls, the racquets,
‫the two that you can see here, then the ball, and then you have the UI, which is the player, the
‫number and the other player and his number.
‫So these are their scores which you also have of course to program.
‫So whenever the ball moves, the players try to hit the ball and bounce it off to the other direction.
‫So the ball should bounce off.
‫And then you try to bring the opponent to a situation where the ball will hit one of the sidewalls.
‫So if it's the sidewall here on the right hand side, then player one gets a point and if it's the other
‫side, then play two gets a point and the ball gets faster every time it hits a racket.
‫So the difficulty goes up and up until it's not possible to hit the ball any more.
‫So at one point the ball will be too fast.
‫And I also have set up a maximum speed.
‫So there will be a speed from which point the ball will not get any faster, but it's still going to
‫be pretty much impossible to still always hit the ball.
‫So if the player plays it well, he can beat you.
‫So the brackets, they have a maximum speed or they have a general speed which is not increased.
‫So the ball's increase.
‫Increase speed is going to be a problem at one point and you just can't hit the ball anymore.
‫Then if you hit the ball at the top side of the racket, the ball will bounce off towards the top.
‫If you hit it at the bottom side of the racket, it will bounce off towards the bottom.
‫So that's something where you can trick the enemy into going towards the wrong direction.
‫All right.
‫So that's about the basic functionality.
‫Let's have a quick look how I solve that.
‫So just so you know how you can do that.
‫So I created a canvas where I have a label player one and a score player one and the same thing for
‫the second player.
‫And I've created scripts, of course, which update the score based on how many points the players have.
‫Then we have the field which consists of all the elements that are part of the game.
‫So in terms of the play mechanics, so we have all the walls and we have the rackets and of course the
‫ball and those middle walls.
‫I have put them in here because it looks a bit better because that just shows where the center point
‫is and all of those walls have a 2D box collider so whenever the ball hits one of those, it will bounce
‫off and the ball itself has a box collider as well.
‫So it bounces off those walls.
‫So you know that you have to use a physics material for them.
‫You have seen those in action and one of the videos then let's have a look at the field a little more.
‫So you have the four walls, you have the middle walls.
‫Which are those five walls here?
‫Then you have the rackets and the records.
‫As you can see here, we use box colors.
‫I created the script.
‫We have the movement speed.
‫They have a rigid body where I froze rotations and so forth.
‫So that's something you will have to look into.
‫And I have the ball here, which has two different sounds, so it plays a specific sound when it hits
‫the wall and it plays a different sound when it hits a racket.
‫And of course, it also needs a rigid body and a box collider.
‫And as you can see here, I have a ball material which bounces off great.
‫So that's about the game.
‫And let's have a quick look at how this plays out.
‫So this the sound played on awake.
‫I set that up just to see if sounds are working.
‫And then as you can see, if it bounce it, if it bounces on the left hand side, it bounces off correctly.
‫So it bounces towards the top.
‫And there you are.
‫I made a point or I got one point.
‫So now I'm just going to lose.
‫I'm just going to move out of the way and lose the game because at five points I will move over to the
‫game over scene and in the game over scene.
‫I have a very simple text which says Game over and a replay button.
‫So that we are game over and replay.
‫And if I hit the replay button, I go back to the game and I have zero zero again and I start a completely
‫new round.
‫As you can see, I have an AI here, so the right racket is moving.
‫Even if I don't do anything.
‫So the left one is run by user input, which in my case is W and S or the arrow keys.
‫And that one here is simply an AI which tries to follow along the position of the ball.
‫So that's what you should try to implement.
‫And then we have our main menu.
‫And from that main menu you can go into the game scene as well.
‫So you have Pong as the title and whenever you hit play you go back into the game.
‫And that's the game scene, of course.
‫So in the game scene, there's one thing that I haven't explained yet.
‫The ball, it bounces off the rackets, but in my case I have implemented the functionality which makes
‫the ball move without physics.
‫So it bounces off.
‫And then regarding the ball, I have used velocity here so I don't add a force to the ball, but I simply
‫use the velocity functionality of the rigid body.
‫So I change the velocity based on bounces for example, and it has a specific velocity at the beginning
‫and then if it bounces off, the velocity goes towards the other direction.
‫So when it bounces off the left racquet, the ball will go towards the right, and if it bounces off
‫the right racquet, it will go towards the left.
‫All right.
‫So that should be pretty much it.
‫As I said, I highly recommend you to try this on your own because you will learn a lot more trying
‫to build this game yourself than just following along the videos or even just watching the videos without
‫trying it in parallel.
‫So go ahead and please let me know if that challenge was too difficult.
‫If you think that there was some functionality missing that you couldn't find in the documentation or
‫that you couldn't find online where you say, okay, this video is really necessary for me to understand
‫what's going on and so forth.
‫Then I can add something, of course, but otherwise you should be able to do that.
‫And if even if something is missing, then it's even better if you find it out on your own because that
‫will teach you to find functionality and find answers to your questions on your own.
‫And that's something that you will definitely need whenever you want to go ahead and build your own
‫projects in the future.
‫All right.
‫So please go ahead and build that or follow along the videos and see you in the next videos or the next
‫chapter.