1
00:00:00,330 --> 00:00:01,000
Welcome back.

2
00:00:01,020 --> 00:00:06,980
And this video, we will create floppy fair game clone, so end of our game overview section.

3
00:00:07,140 --> 00:00:14,820
We learn how to create a game with a black screen and how to make our could include that with method

4
00:00:14,940 --> 00:00:22,920
which used X or Q or in the case of the player or the user.

5
00:00:23,040 --> 00:00:28,190
Now we will covid this code set in the sublime tickets.

6
00:00:28,200 --> 00:00:37,410
Ed has the following and after we finish and the process, we can now use these lines of code to be

7
00:00:37,770 --> 00:00:41,660
the starter code for our game and modify that.

8
00:00:41,700 --> 00:00:43,920
So let's begin then.

9
00:00:43,950 --> 00:00:46,800
We will save this file as.

10
00:00:47,820 --> 00:00:55,980
Lobby that by 5:00, we shall ensure that our best system is passed.

11
00:00:58,250 --> 00:01:06,680
And our view, Centex also is biased now we can run our program to ensure that.

12
00:01:07,490 --> 00:01:17,960
Our game or our code is run correctly as the follow fell out logic and to run correctly without any

13
00:01:17,960 --> 00:01:25,070
problem, the first modification to adjust the resolution to be as a following, which equals four hundred

14
00:01:25,070 --> 00:01:33,560
pixels and height, equals six hundred and fifty pixels and run our game by bending over again to run

15
00:01:33,560 --> 00:01:37,290
correctly with the new resolution, as you see.

16
00:01:37,340 --> 00:01:42,700
Then we will involve the random Python Library or module.

17
00:01:43,220 --> 00:01:48,320
So and the third line we will type in bold, random.

18
00:01:49,440 --> 00:01:59,740
And run our project again, and it will run pretty fine without any problems and closed the game window.

19
00:02:00,180 --> 00:02:07,930
Now we will use the random module to load the VIPs images from the fireplace as the following.

20
00:02:08,130 --> 00:02:17,990
So we will create a list of pipes, images, then loses list using by game and random module.

21
00:02:18,330 --> 00:02:30,240
And the following VIPs underscore less equal between two square brackets and two parentheses for the

22
00:02:30,240 --> 00:02:39,540
first image which exists and site assets slashed by.

23
00:02:42,560 --> 00:02:56,090
There's green, there's bank, and the other image exists and assets slashed by.

24
00:02:58,590 --> 00:03:08,370
Slashed by the red dot bank, closed the central coast and closed the square brackets, then we will

25
00:03:08,370 --> 00:03:12,570
assign the pygame, the image that lood method.

26
00:03:13,600 --> 00:03:24,100
To a variable called by underscore service, saw by underscore surface, equal by game dot image, the

27
00:03:24,100 --> 00:03:35,840
cloud between two parentheses random Dota choice and inside the random choice method by underscore inside

28
00:03:35,890 --> 00:03:38,840
the two parentheses of this method.

29
00:03:39,250 --> 00:03:46,470
Now we will build our program to run our game to ensure that everything is run correctly.

30
00:03:50,130 --> 00:03:55,490
OK, I could run correctly without any problem, as you see now.

31
00:03:55,890 --> 00:04:05,850
We will change the game name from my game to Willoughby Pale Clone, then we will adjust the speed of

32
00:04:05,850 --> 00:04:06,480
the game.

33
00:04:07,570 --> 00:04:17,090
Through creating a new variable called speed, which will equal or assigned to by game, the time dot

34
00:04:17,170 --> 00:04:21,230
clock method was seed capital.

35
00:04:21,460 --> 00:04:30,240
Don't worry, I will change the C small of the clock to the seed capital letters.

36
00:04:30,670 --> 00:04:39,690
The next step to call the speed variable inside the wire loop or the game loop which contains the game

37
00:04:39,700 --> 00:04:44,440
dot the time that clock method or object as a follow.

38
00:04:44,650 --> 00:04:56,360
So speed dot text method which will be used to call by game the time the clock object or method to adjust

39
00:04:56,390 --> 00:05:00,930
the game speed at one hundred milliseconds.

40
00:05:01,540 --> 00:05:13,570
Then we add the background by assign a variable called background to two by game dot image dot load

41
00:05:13,780 --> 00:05:14,530
method.

42
00:05:14,800 --> 00:05:25,150
And inside the two parentheses of this method, we will add the background asset position at our folders

43
00:05:25,150 --> 00:05:28,860
which exists inside the access file.

44
00:05:29,380 --> 00:05:38,920
So background, equal pygame, dot image, dot loop between two entities, assets, class backgrounds

45
00:05:39,100 --> 00:05:43,930
that day the bank and close the parenthesis.

46
00:05:44,350 --> 00:05:54,850
Now we can use the game, underscore display belet method to add our background on our screen or our

47
00:05:54,850 --> 00:05:58,480
game display service as a.

48
00:05:59,230 --> 00:06:10,300
So game underscore display the delay between two parentheses, background and comma and a table of zero

49
00:06:10,300 --> 00:06:10,980
and zero.

50
00:06:11,080 --> 00:06:19,530
This table of zero and zero refer to of the start of the X and Y position of our background.

51
00:06:19,690 --> 00:06:24,840
Close the parentheses and build our project again to see the result.

52
00:06:25,420 --> 00:06:35,110
And after running our game, we found that the X and Y position start correctly, but end end correctly.

53
00:06:35,200 --> 00:06:45,490
We will adjust the width and the height of our project to ensure that the background fits our game display

54
00:06:45,490 --> 00:06:46,480
or our screen.

55
00:06:46,690 --> 00:06:52,660
So the weights will be and the eighty five and our height will be equal.

56
00:06:52,720 --> 00:07:01,960
Five hundred and ten pixels as we said before then we need to add that convert method to the background.

57
00:07:03,620 --> 00:07:12,440
To be the background equal or assigned to buy a game, the damage, the clothes, the asset that convert

58
00:07:12,440 --> 00:07:20,800
metal, as you see, then we build our project to run our game and it runs correctly without any error

59
00:07:20,810 --> 00:07:24,680
and with the correct size of our background.

60
00:07:24,890 --> 00:07:34,670
Then we add the base has it as the following base equal by game dot image to cloud the position of the

61
00:07:34,670 --> 00:07:40,060
asset or where is as it exists in our folder that converts.

62
00:07:40,120 --> 00:07:50,990
Then we need to add this base to the game display or our screen by using game underscore display the

63
00:07:51,100 --> 00:08:00,260
valid method between two parentheses base and a table of zero and zero, which is the X and Y position

64
00:08:00,560 --> 00:08:09,770
which our base asset will start from, then build our blowsy and we see that the base asset is in wrong

65
00:08:09,770 --> 00:08:16,190
position at the top instead of the bottom of the game display or the game screen.

66
00:08:16,290 --> 00:08:24,590
So we will use the table inside the appellate method which express the X and Y position, which will

67
00:08:24,590 --> 00:08:30,300
update only the position as the exposition is OK.

68
00:08:30,320 --> 00:08:39,380
So game underscore display the ballot between two parentheses based comma a of zero and four hundred

69
00:08:39,380 --> 00:08:40,840
and run our game.

70
00:08:40,850 --> 00:08:48,620
It runs correctly with the correct position of the base exit, but we want to perfectly adjust the position

71
00:08:48,620 --> 00:08:55,220
of the base exit so we will change the four hundred to three hundred and fifty adds of our position

72
00:08:55,220 --> 00:09:00,680
and build our Beroza and the base exit style and the wrong position.

73
00:09:00,680 --> 00:09:08,030
So I will use four hundred and thirty five, which is after we build the project, we find that the

74
00:09:08,030 --> 00:09:16,400
Y position fit our game, display our game screen more than four hundred and twenty as you see.

75
00:09:17,000 --> 00:09:25,730
After that we will build it again and observe that the base position is the most appropriate position

76
00:09:25,850 --> 00:09:29,030
for our game screen, for our game display.

77
00:09:29,390 --> 00:09:39,290
Now we want to move this base to make the game look active so we will use the base X position to move

78
00:09:39,500 --> 00:09:46,670
this base and the changing the position of the game base from zero to the base X position.

79
00:09:46,700 --> 00:09:54,020
Now we will add a variable called base underscore X underscore position equals zero.

80
00:09:54,470 --> 00:10:02,630
Then inside the game we will decrease this variable by minus one bexell then build our Brusic again

81
00:10:02,930 --> 00:10:08,510
and the base as it moves from the right to the left, then disappear.

82
00:10:08,510 --> 00:10:15,890
And to prevent the disappearance of our base, we will create a function called Base Underscore Move,

83
00:10:15,890 --> 00:10:25,460
which will contain two or darville assets of our base as a follow and also add if statement inside the

84
00:10:25,460 --> 00:10:35,120
game loop if base underscore x underscore position let then minus two hundred eighty five column so

85
00:10:35,270 --> 00:10:38,900
base underscore X underscore position equals zero.

86
00:10:39,410 --> 00:10:45,230
Then build our project again and the game base is still not moving.

87
00:10:45,380 --> 00:10:48,890
So we will change the statement as the following.

88
00:10:49,190 --> 00:10:58,130
If base underscore X underscore position less than or equal minus two hundred eighty five which is the

89
00:10:58,130 --> 00:11:06,860
width of our game display column base underscore exposition equals zero and run our project again had

90
00:11:06,860 --> 00:11:15,770
to run fine without any problem with the base moving without disappearing at this point which the end

91
00:11:15,770 --> 00:11:16,610
of this lecture.

92
00:11:16,640 --> 00:11:19,520
I hope you enjoyed this you and get all of that.

93
00:11:19,520 --> 00:11:22,240
Thanks for watching and thanks for being here.

94
00:11:22,730 --> 00:11:24,470
See you next with you.
