Hi, welcome back.
And this video, we will start quoting Pong game blown from scratch.
So let's begin, as we learned in the video before this video, that we will begin our game by bored
by game Python Library at the following.
So a new folder called Pong Game.
We will create a new file called Pong, taught by the following.
So after all the folders, we will create another folder called Bong, then inside this file, we will
create.
A new file called Bong Dot by the following, so rename this folder as bong folders.
Then.
Create new file called Bongo's By.
Inside this bond.
But firstly, we will open this folder inside sublime text.
Then create the bomb by five.
By clicking on file, drop down, then choose.
You file, then rename it to Bond to buy or save it as long goodbye five.
And ensure that our bell system is Python and our views and Syntex view is Python.
Then import pygame.
By the module.
Then we will add optional import statement.
To import all the pygame methods as fallen from Bigham import Asterix, then we will import system as
the following import as.
Why is.
Then build our project to ensure that all modules work correctly.
After that, the next step to initialize pygame module, add the following.
Using any method by game to end it and build our Brusic, it will run correctly.
OK, this will initialize all methods and objects inside of our game to be used in our game.
If we need to do that, then we will declare and assign our game variables and the following.
Like equal.
Zero zero comma zero inside to parentheses.
Then.
Also for white equal to parentheses inside the two parentheses, two hundred fifty five.
Coma, two hundred fifty five, coma, two hundred fifty five and size equal.
Eight hundred and six handwrote.
Inside to parents is separated by a common.
This represents the rights and height of our game display.
And we also will assign the game display on the screen and the following game underscore display equal
by game display, dot set underscore mode between two entities size.
Also, we will name our game as bond using set underscore caption method of pygame module.
So by game display dot set underscore caption between two parentheses.
And to think it could.
Bong.
And run our game by building our project to get a black screen has our eyes of eight hundred pixels
and a height of six hundred pixels.
We want to start our game loop, and to do that, we need to create a volume variable that can be used
inside the game loop as the following.
So game underscore on equal to.
Now we can add Zouliou or the game loop while game on Collum, now we will use the game clock and time
to control our game speed.
So block equal pygame.
The time that clock with Capital S. then to parentheses and inside the while loop, we will add for
loop at the following for event and by game event dot get method column.
And inside the for loop we will add if statement as the following, if even the type doesn't equal by
game dot quick column game underscore on equal fault and in the same identity of the for loop, we will
make our game display blank as the following game underscore that fell between two parentheses.
Then we will draw the neck of the game using pygame.
Draw that line method so pygame don't draw the line between two parentheses.
My screen is game underscore display comma and also game display is our self.
My color is why comma.
And we need to add the two points of the beginning and the end of this line, which is four hundred
and zero between two square bracket as I separated with a comma and another list for the point to for
the end of this line, which is four hundred and six hundred inside a list separated by a comma and
coma.
And lastly, we will add the width of our line, which is five pixels and close the parentheses of pygame.
Gaudreau The time is now.
We need to update the game display using update method of pygame modules as the following by game dot
display the update method, then adjust the game frames to sixty frames per second using clock the text
method as the clock the text between two parentheses sexy.
Then we can now stop the game loop so the game stop running also using game dot method.
Now we can run our game by building our process to see if we called our game correctly or not.
So let's run it by clicking on tools and build our project.
We will get a black screen.
Has I made the line?
OK, that's perfect.
Hope you enjoyed this lecture and get all of that.
Thanks for being here and thanks for watching.
See you next lecture's.