1
00:00:00,180 --> 00:00:05,160
We've created a way to end the game, but we don't have a great way to restart the game, so we see

2
00:00:05,160 --> 00:00:09,960
that once we we get the restart content, but we're generating a new car.

3
00:00:09,960 --> 00:00:14,430
And there's quite a few things that are happening there that we don't actually need happening within

4
00:00:14,430 --> 00:00:14,880
the page.

5
00:00:15,060 --> 00:00:19,920
And that's because our game area, we're generating a bunch of stuff that's already existing.

6
00:00:20,160 --> 00:00:26,490
So I want to select game area and update the entire HTML and just simply remove out all of the content

7
00:00:26,640 --> 00:00:28,010
that's been available there.

8
00:00:28,260 --> 00:00:31,680
I'm also going to be removing out the height of the gameplay.

9
00:00:32,700 --> 00:00:38,280
As we don't need that anymore, because we actually do want to see the road in the background, so let's

10
00:00:38,280 --> 00:00:40,100
try that out and refresh it.

11
00:00:40,620 --> 00:00:43,010
And when we hit start, let's see what happens.

12
00:00:43,800 --> 00:00:47,490
And now we can hit start again and we're able to start the game once again.

13
00:00:47,790 --> 00:00:53,880
And we can always restart the game because now we're zeroing out what we're building out within the

14
00:00:53,880 --> 00:00:54,300
gameplay.

15
00:00:54,310 --> 00:00:59,220
So we're not adding any extra cars and we're not adding to the confusion of what's happening within

16
00:00:59,220 --> 00:00:59,780
the gameplay.

17
00:01:00,270 --> 00:01:05,220
So we needed to always clear out and reset it back to its initial state.

18
00:01:05,520 --> 00:01:11,220
So just quickly go through that and you can see that we're setting that animation frame.

19
00:01:11,790 --> 00:01:13,160
We're creating the car.

20
00:01:13,200 --> 00:01:19,470
So all of this is being done and it's resetting basically all of the parameters of the game and rebuilding

21
00:01:19,470 --> 00:01:22,000
all of the elements that we're using within the gameplay.

22
00:01:22,440 --> 00:01:27,720
So by clearing it out and sending the inner turmoil to blank, that's essentially clearing everything

23
00:01:27,720 --> 00:01:27,960
out.

24
00:01:28,080 --> 00:01:30,480
And we already have the player content here.

25
00:01:30,480 --> 00:01:34,120
So the players start and player score is already added in there.

26
00:01:34,290 --> 00:01:39,270
So those are the two parameters that we also need to reset in order to create the gameplay.

27
00:01:39,450 --> 00:01:43,470
So now that we've generated that, we can update some of the styling.

28
00:01:43,470 --> 00:01:46,050
And coming up next, we'll do a final run through.

29
00:01:46,290 --> 00:01:51,780
And one of the things that I did say that I want to add in is the ability to generate random colors

30
00:01:51,780 --> 00:01:53,700
for the bad guy cars.

31
00:01:54,030 --> 00:01:56,940
So let's set that up and I'll show you how to do that.

32
00:01:57,330 --> 00:02:03,120
And we go into our functions and we need a way where we're setting it to red.

33
00:02:03,300 --> 00:02:08,490
We need a way to generate a different color for those cars.

34
00:02:08,910 --> 00:02:10,320
So I'll show you how to do that.

35
00:02:10,470 --> 00:02:12,870
And that's just an extra so you don't have to do that.

36
00:02:12,870 --> 00:02:16,800
All of the gameplay is still there, but I'll show you how to do that in the upcoming LESSEM.

37
00:02:16,980 --> 00:02:20,400
That's a quick bonus less instead of red, it'll be random color.
