1
00:00:00,240 --> 00:00:01,870
Hi, welcome back.

2
00:00:02,130 --> 00:00:11,250
In this video, we will add pilots to the game display and make it is born every time Bériot as the

3
00:00:11,250 --> 00:00:11,790
following.

4
00:00:12,660 --> 00:00:22,080
In the first lecture of this section, we created the by Celeste and make random module able to choose

5
00:00:22,860 --> 00:00:27,240
one type of the two types of these Vibs.

6
00:00:27,790 --> 00:00:42,970
Now we will change the variable name, which called buy into my service as a following, so by underscores

7
00:00:43,000 --> 00:00:53,330
or equal buy game dot image dot between two parentheses, random Dota choice and inside the sound bytes

8
00:00:53,380 --> 00:00:54,880
underscore lest.

9
00:00:55,510 --> 00:01:07,360
Then we will create an empty list called Vibe's list to the following, so perhaps underscore less to

10
00:01:07,720 --> 00:01:11,770
equal empty to square brackets.

11
00:01:12,540 --> 00:01:24,110
Then add a new variable called So Underscore five, which will equal pygame, game, dot user, even

12
00:01:24,840 --> 00:01:31,530
all character of user event are in capital case.

13
00:01:31,830 --> 00:01:39,490
This variable will equal user event in capital case, which will be activated by a timer.

14
00:01:39,510 --> 00:01:48,660
So we need to create a timer and we can create a timer by using by game the time the set time method

15
00:01:48,660 --> 00:01:50,790
as the following by game.

16
00:01:50,790 --> 00:02:02,310
The time dot set on the timer between two parentheses so underscore by comma one thousand milliseconds

17
00:02:02,340 --> 00:02:04,680
then an event handler function.

18
00:02:04,680 --> 00:02:10,830
We will add the following code to solve that by using new statements.

19
00:02:10,870 --> 00:02:22,260
So if event dot type doesn't equal so underscored by column by underscore less to not have been between

20
00:02:22,260 --> 00:02:26,870
two parentheses adding by a method or function.

21
00:02:27,270 --> 00:02:35,130
So our empty list will be filled with the idea of the adding by function.

22
00:02:35,160 --> 00:02:44,250
So now we need to create this new function, add the first part of the code with other functions and

23
00:02:44,260 --> 00:02:45,000
the following.

24
00:02:45,240 --> 00:02:52,710
So def adding underscore pipes and to empty parentheses column.

25
00:02:52,950 --> 00:03:03,420
Then inside the function we will add new by equal by the get the track between two parentheses method

26
00:03:03,990 --> 00:03:09,020
which are the half of the game display dimension.

27
00:03:09,450 --> 00:03:21,750
So method equals a table of X and Y position which are three handwriting and comma and two hundred fifty

28
00:03:22,110 --> 00:03:22,800
five.

29
00:03:23,070 --> 00:03:32,820
Close the parentheses then in the second line inside the function we will add return new by then add

30
00:03:32,820 --> 00:03:42,360
new function to move the bytes as the following d.f. by underscore and move between two parentheses

31
00:03:42,690 --> 00:03:52,590
pipes then add column then inside the function as a follow for byte imbibes column.

32
00:03:53,830 --> 00:03:58,090
By the center X minus five.

33
00:03:58,970 --> 00:04:11,390
Then return VIPs and a new line inside the function, this function will take every VIPs list and move

34
00:04:11,390 --> 00:04:16,990
at by minus five pixels in the x axis.

35
00:04:17,000 --> 00:04:23,560
So it will move to the left, then return and new list of pipes.

36
00:04:23,570 --> 00:04:33,020
Now, in the event handler function, we will add VIPs underscore less to equal five underscore move

37
00:04:33,230 --> 00:04:39,290
between two parentheses by underscore less to then and a new line.

38
00:04:39,620 --> 00:04:44,500
We will also underscore bypass function as a following.

39
00:04:44,840 --> 00:04:50,450
So underscore Vibe's and the add to empty parentheses of the method.

40
00:04:51,170 --> 00:04:53,690
Now we need to create the show.

41
00:04:53,750 --> 00:05:01,530
Pipes function as the following def so underscore vibes between two parentheses by column.

42
00:05:01,700 --> 00:05:10,330
Then inside the function we will add a for loop, the following for item and bytes column.

43
00:05:10,880 --> 00:05:20,450
And inside this four loop we will add this line of good game underscore display belet between two parentheses

44
00:05:20,450 --> 00:05:29,350
by service and by now we will try to build out Brusic to see if we have any errors in our code.

45
00:05:30,080 --> 00:05:32,210
So let's build it.

46
00:05:35,000 --> 00:05:40,970
We have an error due to using time instead of time.

47
00:05:44,400 --> 00:05:55,920
And by the time the set time, not the time set time, we will change it from time to time and run the

48
00:05:55,920 --> 00:06:00,360
project again and we get another two errors.

49
00:06:00,600 --> 00:06:04,320
The first error, the two we have to change.

50
00:06:04,920 --> 00:06:16,410
The assignment of pipes underscore later to to Vibe's underscore move method to to be inside the game

51
00:06:16,410 --> 00:06:18,270
loop as the following.

52
00:06:18,810 --> 00:06:29,400
And the second error is due to we forget to add the parameter offshore method as the following so underscore

53
00:06:29,400 --> 00:06:34,500
by between two, parentheses by list two.

54
00:06:34,690 --> 00:06:41,910
Then we will build our music again to see if we will have other errors again.

55
00:06:42,210 --> 00:06:51,180
And if you focus on the game screen, you can observe the frequency of adding new bytes are very fast.

56
00:06:51,360 --> 00:07:02,070
So we will adjust this frequency by using by game the time that the time and method to change the parameter

57
00:07:02,070 --> 00:07:11,700
of one thousand milliseconds to seven hundred and fifty milliseconds only and build the project again,

58
00:07:12,030 --> 00:07:16,860
it will run with the correct frequency of adding new bytes.

59
00:07:17,070 --> 00:07:25,050
Also, we will change the speed, the take from one hundred milliseconds to 80 seconds.

60
00:07:25,440 --> 00:07:30,720
And after running the project again, it will run smoothly without any error.

61
00:07:30,870 --> 00:07:39,240
And with the correct games beat, you can set a timer to 800 or 900.

62
00:07:40,500 --> 00:07:51,990
Both times are perfect for our game, 800 or 900 milliseconds, as you see, I will build the project

63
00:07:51,990 --> 00:08:00,790
again after changing the eight hundred seconds to 900 seconds as the following.

64
00:08:05,390 --> 00:08:10,040
And it will run perfectly with this time.

65
00:08:11,380 --> 00:08:17,290
We have added the bottom fives and we need now to add.

66
00:08:18,170 --> 00:08:27,720
Zettabytes as the following, so and so by its function, we will add if statement as the following

67
00:08:27,770 --> 00:08:28,910
if pipes.

68
00:08:29,840 --> 00:08:43,280
That bottle, more than five hundred and ten collomb, so if by the bottom more than or equal, five

69
00:08:43,280 --> 00:08:47,900
hundred and ten, which is that is Billey High as you see.

70
00:08:48,860 --> 00:08:59,780
Game, this delay, though, delayed by service and underbite, so the game will show the bottom by

71
00:08:59,810 --> 00:09:04,160
in case of the vibe, the bottom more than or equal.

72
00:09:04,170 --> 00:09:12,170
Five hundred and ten, which are the heart of the game screen, all game display, or else it will show

73
00:09:12,170 --> 00:09:15,900
the reverse pipes or the top pipes.

74
00:09:16,100 --> 00:09:29,270
So El Collomb reverse underscored by equal by game to transform not between two parentheses by service

75
00:09:29,630 --> 00:09:31,730
and false and true.

76
00:09:32,270 --> 00:09:40,910
So we will add another pipes list but in reverse position or top position of the game display and use

77
00:09:40,910 --> 00:09:53,970
transform just up to flip the pipes left and the Y axis only by adjusting its value to true then cobie

78
00:09:53,990 --> 00:10:04,100
the game underscore displayed the method and visited in the second line after requests by party change

79
00:10:04,100 --> 00:10:05,690
the pipe service.

80
00:10:06,110 --> 00:10:09,320
We will belet the reverse pipe.

81
00:10:09,320 --> 00:10:17,840
OK, now we need to add random positions of the pipes inside the adding by function as the following

82
00:10:18,020 --> 00:10:27,560
random underscore pipe underscore height equal random choice between two parentheses by underscore.

83
00:10:27,560 --> 00:10:34,890
Right now we need to assign heights as a variable as the following pipe.

84
00:10:35,210 --> 00:10:45,780
Underscore height equal a list of values which are one hundred and fifty comma.

85
00:10:45,920 --> 00:10:49,880
Two hundred and fifty comma, three hundred and fifty.

86
00:10:50,750 --> 00:11:00,140
Then we copy the line of code of new by inside the adding bypass function and paste it again and rename

87
00:11:00,140 --> 00:11:05,480
the first one to the base pipe and second one to top pipe.

88
00:11:05,750 --> 00:11:16,190
And the change the top of the base pipe to the bottom and the return the to bypass the base pipe and

89
00:11:16,190 --> 00:11:22,910
the top pipe and to avoid the error of showing the two pipes on each other.

90
00:11:23,000 --> 00:11:34,180
We will change the base pipe and to make bottom equal to handle the eight and random pipe height and

91
00:11:34,950 --> 00:11:39,770
and will do the same thing for top pipe.

92
00:11:40,430 --> 00:11:49,970
And in case of base VIPR, we will subtract two hundred pixels from the random by height and the following

93
00:11:50,090 --> 00:11:54,020
to return a table of the two vibe's top and the base.

94
00:11:54,020 --> 00:12:03,530
We will change Aben to extend and build our Brusic to run correctly with one problem only that the top

95
00:12:03,530 --> 00:12:06,440
five is incorrect direction.

96
00:12:06,680 --> 00:12:16,070
So what we can do to avoid this error, we firstly will change the two hundred to one hundred and fifty

97
00:12:16,070 --> 00:12:19,250
pixels only and build our project again.

98
00:12:23,300 --> 00:12:31,970
So the distance between the two pipes are appropriate and we will change the heights to two hundred

99
00:12:32,750 --> 00:12:43,160
and two and three hundred and 400, which is more appropriate for our pipes.

100
00:12:44,430 --> 00:12:45,180
As you see.

101
00:12:46,720 --> 00:12:56,560
OK, now we solve the problem of the wrong direction of our pipes as the following, we will return

102
00:12:56,560 --> 00:13:01,830
to the show by its method or function and change it.

103
00:13:02,110 --> 00:13:13,000
So for imbibes column and pipe the bottom more than or equal five hundred and ten column game display

104
00:13:13,040 --> 00:13:24,070
the belt between two parentheses five serves and five ls column the words underscored by equal by game

105
00:13:24,070 --> 00:13:28,240
to transform not fill up between two parentheses.

106
00:13:29,190 --> 00:13:33,150
By service, comma, fourth, comma through.

107
00:13:34,300 --> 00:13:42,100
In the second line game underscored display the pellet between two parentheses, reverse, underscore

108
00:13:42,100 --> 00:13:50,590
by and by and run our project again and it will run correctly without any errors, with the correct

109
00:13:50,590 --> 00:13:59,740
height of the top and the base pipes and also with the correct base between the two by the top and the

110
00:13:59,740 --> 00:14:00,130
base.

111
00:14:00,130 --> 00:14:07,030
And also and also we observe that the direction of the top and the base vibes are correct.

112
00:14:07,450 --> 00:14:12,080
OK, at this point we reach the end of this lecture.

113
00:14:12,100 --> 00:14:13,750
Hope you enjoyed this lecture.

114
00:14:13,750 --> 00:14:18,160
And to get all of that, thanks for watching and thanks for being here.

115
00:14:18,550 --> 00:14:20,020
See you next week.
