1
00:00:00,390 --> 00:00:04,530
This is the lesson we're going to take a look at the game that we've been building out in the earlier

2
00:00:04,530 --> 00:00:06,960
lessons and see how we can make it better.

3
00:00:07,230 --> 00:00:11,060
So so far, we have a basic game play area.

4
00:00:11,430 --> 00:00:15,070
We have an element that we create using JavaScript.

5
00:00:15,090 --> 00:00:18,090
So this is created on the fly and the objective of the game.

6
00:00:18,090 --> 00:00:23,670
It's very simple and straightforward to move around your mouse cursor in order to get on top of this

7
00:00:23,670 --> 00:00:26,960
element that keeps moving around all over the screen.

8
00:00:27,300 --> 00:00:32,010
And so we want to move on top of it and we want to have the ability to maybe click on it.

9
00:00:32,160 --> 00:00:36,210
And we have that option already added in, but we're not tracking any scoring.

10
00:00:36,390 --> 00:00:38,970
So the score could make this game more interesting.

11
00:00:39,030 --> 00:00:41,730
So let's go ahead and introduce that into our game.

12
00:00:41,940 --> 00:00:44,610
So we're going to have a great spot that we can add in the score.

13
00:00:44,730 --> 00:00:49,470
And it's going to be relatively easy to add this in because we already have that structure in place.

14
00:00:49,740 --> 00:00:56,190
So if we do score and we can just call this a class of S. So it doesn't actually matter what class we

15
00:00:56,190 --> 00:01:02,910
give it as we're not referencing it via the classes, we're getting its variable value by inter text

16
00:01:03,510 --> 00:01:05,000
that's being contained within EA.

17
00:01:05,280 --> 00:01:10,170
So let's create a global object four score and set that to zero.

18
00:01:10,290 --> 00:01:13,050
And then every time we click on it, we're going to update the score.

19
00:01:13,230 --> 00:01:20,010
So going down to where we had the click, we're going to take score incremented by one and then output

20
00:01:20,010 --> 00:01:24,300
that content into the visible area, into that visible element.

21
00:01:24,360 --> 00:01:30,060
You're going to slow this down a little bit because it's going to be kind of hard for me to catch this

22
00:01:30,060 --> 00:01:30,300
one.

23
00:01:30,600 --> 00:01:32,580
So I want to be able to test it properly.

24
00:01:32,580 --> 00:01:35,400
So let's slow this down quite a bit.

25
00:01:35,550 --> 00:01:39,030
And you can see that now as I click on it, my scores are increasing.

26
00:01:39,190 --> 00:01:42,780
So I do have the ability to track the number of clicks that are being done on it.

27
00:01:43,110 --> 00:01:43,710
So great.

28
00:01:43,710 --> 00:01:45,930
And we can speed that back up again.

29
00:01:45,960 --> 00:01:49,650
And you could adjust the speed as needed to make it more interesting.

30
00:01:49,680 --> 00:01:52,390
You could also have more randomness within the speed, of course.

31
00:01:52,440 --> 00:01:56,100
So it's all up to you however you want to create this type of interaction.

32
00:01:56,100 --> 00:02:01,140
And of course, the faster the speed, the harder it is for the user to kind of catch it and click on

33
00:02:01,140 --> 00:02:02,640
it, even though it's still possible.

34
00:02:02,640 --> 00:02:04,400
So it makes the game more interesting.

35
00:02:04,830 --> 00:02:06,870
So it looks like we've got a completed game.

36
00:02:06,870 --> 00:02:11,430
And at this point, usually it's a good idea to kind of play through it and make sure that it's met

37
00:02:11,430 --> 00:02:14,820
all of your objectives that you set out to in order to create it.

38
00:02:14,820 --> 00:02:18,690
And once it does, then you're ready to launch your game.

39
00:02:18,690 --> 00:02:24,300
And coming up next, we'll run through our source code and do a quick code review of all of the code

40
00:02:24,300 --> 00:02:27,270
that we've generated and created in the earlier lessons.
