Hi, welcome back.
And this video, we will apply the collisions between the bird and the pipes, but the question is how
we can do that.
We can do that using the rectangles around these pipes and this bird and check the collisions between
these rectangles using.
We will create a new variable called game underscore on our game on equal a volume value through.
Then we will create a new function called collisions.
So the F collisions between two parentheses by its then column.
Then inside this function we will pass as the following.
So instead of best, we will add a loop four by and by column F bell dot collide between two parentheses
by column and inside the statement that will return false.
So the game will of not on all the game will end.
And also if that underscore rectangle dot top less than or equal twenty five or better underscore rec
bottom more than four equals four hundred thirty five which is the top of the gameplay and the bottom
which is the base of the game.
So if the word collide with the base for the top of the gameplay, the game will over and the player
will lose.
So this second statement will also return false.
OK, and if the two conditions not having the function return, true.
So the game is on and the player will continue to play the game and we need to adjust these lines of
code and cut and paste that inside.
And if statement is the following and also by underscore, let's two to be equal five underscore move
between two parentheses by underscore less to two and assign the variable game on to a new value to
be equal collisions between two parentheses by choice underscore two.
So this part of code will only function if the game is on and if the game is not on board, the game
is over and the player lose.
This part of code wasn't working and if we build our Brozak, we will find that we have an error due
to wrong identification of the return two of the collision function.
So we will fix that by adjusting the wrong identity and then build our project again.
And our game will work fine without any error.
And we will build our project again to check the collisions.
And our collision is working fine.
But we have a small problem that our game is still running without the fights and the bad.
Please take ten seconds to think about the way we have to solve this problem properly.
We can solve this problem by change the statement.
L.F. not even the type that would equal by game dot.
OK, that one and the ad and game underscore on double equal to column, so the statement and the nested
F a statement inside that will not work until the two conditions are through.
We will copy the same lines of code again with some changes, with some changes as the following that
game on equal force in the state of true.
And also, we will remove the word movement, two lines of code and add Vibe's underscore to the clear
method to clear the pipes after the game is over and the ad game underscore on, well, equal through.
So the game will start again, then adjust the movement again at zero value.
Then we will build our Brozak the game to ensure that our project is working fine without any errors.
So the game is running OK and restored correctly without any errors, as you see.
But in case the bell collide with the game base, there is a problem.
OK, we will solve this problem through the following solution.
Bears underscore rectangle center equal between two parentheses twenty five comma two hundred fifty
five and build our project again.
And we see that half the words collide with the top or the bottom, which is the base of the game.
The game will start by clicking pace.
So if we run the game it will run until the world collide with the vibe.
After each laughs by clicking this base and to start the game again, we will just click this game.
At this point, we reach the end of this lecture.
I hope you enjoyed this lecture and get all of that.
Thanks for watching and thanks for being here.
See you next, Viju.