WEBVTT

0
00:00.270 --> 00:03.480
Now, hopefully you've already downloaded the starting project,

1
00:03.840 --> 00:07.020
so you can go ahead and click open in PyCharm,

2
00:07.410 --> 00:12.410
find the location where you've downloaded your turtle-crossing-start and make

3
00:12.510 --> 00:14.850
sure that you've unzipped that zip file

4
00:15.420 --> 00:20.100
and you've got the actual folder, which contains all of the starting files.

5
00:20.640 --> 00:25.640
So select the folder and then click open and we have to configure a Python

6
00:26.340 --> 00:31.340
interpreter and make sure that your Python interpreter is at a minimum of Python

7
00:31.380 --> 00:34.680
3.8. So you can use 3.9 or above,

8
00:35.010 --> 00:36.930
but if it's lower than 3.8,

9
00:36.930 --> 00:41.930
you might get some errors and some problems. Refer back to when we first started

10
00:42.270 --> 00:46.590
out using PyCharm and we installed Python if you get stuck on this.

11
00:47.370 --> 00:50.670
Now, if you take a look at inside our project folder,

12
00:50.970 --> 00:54.390
you can see I've already created four files for you.

13
00:54.960 --> 00:56.940
These files are pretty bare bones,

14
00:56.970 --> 01:00.420
but if you take a look at the main.py file

15
01:00.630 --> 01:03.420
which is your starting point for your program,

16
01:03.720 --> 01:07.710
you can see that I've written a little bit of code that we learned about in

17
01:07.710 --> 01:08.790
previous lessons.

18
01:09.090 --> 01:14.090
So we've created a screen object and we've set up the screen to be 600 by 600

19
01:15.270 --> 01:16.103
pixels.

20
01:16.410 --> 01:21.030
And then we've turned off the tracer by doing the tracer(0),

21
01:21.480 --> 01:26.400
and instead, we're getting the screen to update every 0.1 seconds.

22
01:26.850 --> 01:31.620
So within the while loop, the code is going to run every 0.1 seconds.

23
01:31.980 --> 01:35.100
So whatever it is that you put inside this while loop,

24
01:35.460 --> 01:38.490
it's going to be refreshed every 0.1 seconds.

25
01:39.180 --> 01:44.180
Now, you'll also see that I've imported some classes from these files; player,

26
01:45.870 --> 01:49.170
car_manager, and scoreboard. Now,

27
01:49.230 --> 01:50.970
inside these files,

28
01:51.210 --> 01:54.360
I've created the starting point for each of the classes.

29
01:54.690 --> 01:58.350
The player class is going to be the turtle which we're controlling to cross

30
01:58.350 --> 01:59.160
the road,

31
01:59.160 --> 02:04.160
the car manager is going to generate all of the random cars and move them

32
02:04.200 --> 02:05.160
across the screen,

33
02:05.580 --> 02:08.730
and then the scoreboard is just going to write the level that we're currently

34
02:08.730 --> 02:11.970
on and also the game over a sequence. Now,

35
02:12.000 --> 02:15.690
inside each of these classes, I've got pass written here

36
02:15.720 --> 02:19.290
just so that the linter will stop screaming at me. So,

37
02:19.950 --> 02:23.430
as we mentioned before, Python doesn't like things are empty,

38
02:23.430 --> 02:27.630
so empty functions, empty classes, and you'll get these errors.

39
02:28.410 --> 02:32.610
Instead of getting these errors, all I've done is simply written pass

40
02:32.640 --> 02:35.490
which essentially just makes this an empty class.

41
02:35.910 --> 02:37.560
So when you're creating these classes,

42
02:37.620 --> 02:41.880
just delete the pass and you can create it as you would normally. Now,

43
02:41.910 --> 02:45.420
in addition, we've got all of these constants in here. For example,

44
02:45.420 --> 02:47.640
the starting position of the player turtle,

45
02:47.970 --> 02:52.320
how much the turtle should move each time and where the finish line

46
02:52.320 --> 02:55.380
is on the Y-axis. In the car_manager

47
02:55.380 --> 02:57.660
we've got the colors of the cars,

48
02:57.960 --> 03:02.820
we've got the move distance of each of the cars on each refresh,

49
03:03.150 --> 03:08.150
and we've also got how much the move distance should increase every time the

50
03:08.280 --> 03:11.880
user levels up. Finally, we've got the scoreboard

51
03:11.910 --> 03:16.050
which just contains the font that you are going to use to write out the score

52
03:16.050 --> 03:20.850
board. That's pretty much an introduction to the starting file.

53
03:21.180 --> 03:22.350
So once you're ready,

54
03:22.410 --> 03:27.410
feel free to head over to the next lesson and get started with each step of the

55
03:28.080 --> 03:28.500
game.