1
00:00:00,270 --> 00:00:03,480
Now, hopefully you've already downloaded the starting project,

2
00:00:03,840 --> 00:00:07,020
so you can go ahead and click open in PyCharm,

3
00:00:07,410 --> 00:00:12,410
find the location where you've downloaded your turtle-crossing-start and make

4
00:00:12,510 --> 00:00:14,850
sure that you've unzipped that zip file

5
00:00:15,420 --> 00:00:20,100
and you've got the actual folder, which contains all of the starting files.

6
00:00:20,640 --> 00:00:25,640
So select the folder and then click open and we have to configure a Python

7
00:00:26,340 --> 00:00:31,340
interpreter and make sure that your Python interpreter is at a minimum of Python

8
00:00:31,380 --> 00:00:34,680
3.8. So you can use 3.9 or above,

9
00:00:35,010 --> 00:00:36,930
but if it's lower than 3.8,

10
00:00:36,930 --> 00:00:41,930
you might get some errors and some problems. Refer back to when we first started

11
00:00:42,270 --> 00:00:46,590
out using PyCharm and we installed Python if you get stuck on this.

12
00:00:47,370 --> 00:00:50,670
Now, if you take a look at inside our project folder,

13
00:00:50,970 --> 00:00:54,390
you can see I've already created four files for you.

14
00:00:54,960 --> 00:00:56,940
These files are pretty bare bones,

15
00:00:56,970 --> 00:01:00,420
but if you take a look at the main.py file

16
00:01:00,630 --> 00:01:03,420
which is your starting point for your program,

17
00:01:03,720 --> 00:01:07,710
you can see that I've written a little bit of code that we learned about in

18
00:01:07,710 --> 00:01:08,790
previous lessons.

19
00:01:09,090 --> 00:01:14,090
So we've created a screen object and we've set up the screen to be 600 by 600

20
00:01:15,270 --> 00:01:16,103
pixels.

21
00:01:16,410 --> 00:01:21,030
And then we've turned off the tracer by doing the tracer(0),

22
00:01:21,480 --> 00:01:26,400
and instead, we're getting the screen to update every 0.1 seconds.

23
00:01:26,850 --> 00:01:31,620
So within the while loop, the code is going to run every 0.1 seconds.

24
00:01:31,980 --> 00:01:35,100
So whatever it is that you put inside this while loop,

25
00:01:35,460 --> 00:01:38,490
it's going to be refreshed every 0.1 seconds.

26
00:01:39,180 --> 00:01:44,180
Now, you'll also see that I've imported some classes from these files; player,

27
00:01:45,870 --> 00:01:49,170
car_manager, and scoreboard. Now,

28
00:01:49,230 --> 00:01:50,970
inside these files,

29
00:01:51,210 --> 00:01:54,360
I've created the starting point for each of the classes.

30
00:01:54,690 --> 00:01:58,350
The player class is going to be the turtle which we're controlling to cross

31
00:01:58,350 --> 00:01:59,160
the road,

32
00:01:59,160 --> 00:02:04,160
the car manager is going to generate all of the random cars and move them

33
00:02:04,200 --> 00:02:05,160
across the screen,

34
00:02:05,580 --> 00:02:08,729
and then the scoreboard is just going to write the level that we're currently

35
00:02:08,729 --> 00:02:11,970
on and also the game over a sequence. Now,

36
00:02:12,000 --> 00:02:15,690
inside each of these classes, I've got pass written here

37
00:02:15,720 --> 00:02:19,290
just so that the linter will stop screaming at me. So,

38
00:02:19,950 --> 00:02:23,430
as we mentioned before, Python doesn't like things are empty,

39
00:02:23,430 --> 00:02:27,630
so empty functions, empty classes, and you'll get these errors.

40
00:02:28,410 --> 00:02:32,610
Instead of getting these errors, all I've done is simply written pass

41
00:02:32,640 --> 00:02:35,490
which essentially just makes this an empty class.

42
00:02:35,910 --> 00:02:37,560
So when you're creating these classes,

43
00:02:37,620 --> 00:02:41,880
just delete the pass and you can create it as you would normally. Now,

44
00:02:41,910 --> 00:02:45,420
in addition, we've got all of these constants in here. For example,

45
00:02:45,420 --> 00:02:47,640
the starting position of the player turtle,

46
00:02:47,970 --> 00:02:52,320
how much the turtle should move each time and where the finish line

47
00:02:52,320 --> 00:02:55,380
is on the Y-axis. In the car_manager

48
00:02:55,380 --> 00:02:57,660
we've got the colors of the cars,

49
00:02:57,960 --> 00:03:02,820
we've got the move distance of each of the cars on each refresh,

50
00:03:03,150 --> 00:03:08,150
and we've also got how much the move distance should increase every time the

51
00:03:08,280 --> 00:03:11,880
user levels up. Finally, we've got the scoreboard

52
00:03:11,910 --> 00:03:16,050
which just contains the font that you are going to use to write out the score

53
00:03:16,050 --> 00:03:20,850
board. That's pretty much an introduction to the starting file.

54
00:03:21,180 --> 00:03:22,350
So once you're ready,

55
00:03:22,410 --> 00:03:27,410
feel free to head over to the next lesson and get started with each step of the

56
00:03:28,080 --> 00:03:28,500
game.

