1
00:00:00,150 --> 00:00:04,920
When you're creating games, you're going to find you're playing through them over and over again until

2
00:00:04,920 --> 00:00:09,840
you finally get the finished product that you were looking for and that you set off to do again to update

3
00:00:09,840 --> 00:00:11,860
some of the styling within the top bar.

4
00:00:12,000 --> 00:00:15,930
So that's where we've got our message and our score setting a height for it.

5
00:00:15,930 --> 00:00:19,830
Width and the width is just going to be 100 percent full across.

6
00:00:20,160 --> 00:00:29,160
So the background color and make the background color black and the font color white and also text the

7
00:00:29,160 --> 00:00:29,550
lines.

8
00:00:29,550 --> 00:00:30,900
So center the text.

9
00:00:31,140 --> 00:00:32,250
So see how that looks.

10
00:00:32,520 --> 00:00:37,320
So now we've got our score at the top and we're ready to play through the game and just get a better

11
00:00:37,320 --> 00:00:41,550
feel for to see if anything's going wrong, if we need to make any final adjustments.

12
00:00:41,890 --> 00:00:43,790
So we've got our start game button.

13
00:00:44,070 --> 00:00:46,020
We've got our ship here.

14
00:00:46,020 --> 00:00:50,250
So that's all visible and a score of zero and we start out so clicking through.

15
00:00:50,250 --> 00:00:52,080
We see we've got five aliens.

16
00:00:52,380 --> 00:00:53,790
We can shoot at the aliens.

17
00:00:54,860 --> 00:01:00,290
And the objective is to get the aliens before they get to the bottom and you can adjust, tweak the

18
00:01:00,290 --> 00:01:02,000
speed of the aliens as needed.

19
00:01:02,900 --> 00:01:10,460
So once you get all of the final aliens, you get you one on within the output and you should also have

20
00:01:10,460 --> 00:01:12,070
the option to start again.

21
00:01:12,290 --> 00:01:18,860
So it didn't finish that finalizing of the gameplay and we can run the same function as we did when

22
00:01:18,860 --> 00:01:24,140
we won where we go through and we reset the game playing.

23
00:01:24,150 --> 00:01:28,340
So if clearing out all of the aliens, so that's another option that we can do.

24
00:01:28,340 --> 00:01:31,550
So we have that function that we set up in order to.

25
00:01:32,740 --> 00:01:41,770
Run the game over and we don't have that over here, but we do have the game over functionality, so

26
00:01:41,770 --> 00:01:42,660
let's add that in.

27
00:01:43,780 --> 00:01:49,990
So instead of just you one, we want to run a game over function, and that's the same one that's going

28
00:01:49,990 --> 00:01:56,890
to reset some of the values and restore our start button so that we can restart the game and play again.

29
00:01:57,010 --> 00:02:00,300
And all it's doing is display, block, restart new game.

30
00:02:00,640 --> 00:02:03,300
You could also output the message here if you wanted to.

31
00:02:03,490 --> 00:02:05,690
So that's another option that you have available.

32
00:02:06,280 --> 00:02:11,110
So again, it is quite a few times that you usually have to play through just to make sure you get all

33
00:02:11,110 --> 00:02:12,760
of the functionality that you want.

34
00:02:13,030 --> 00:02:16,750
And this time we'll try it one more time so we have the ability to restart the game.

35
00:02:16,760 --> 00:02:19,900
We got our score, we got you one and restart the game.

36
00:02:19,900 --> 00:02:21,150
So we start a fresh game.

37
00:02:21,460 --> 00:02:24,280
Notice that the score didn't go back to zero.

38
00:02:24,490 --> 00:02:31,660
So that's one of the thing that we need to take care of and within the player object taking our score.

39
00:02:31,660 --> 00:02:34,620
So that should always go back and reset to zero.

40
00:02:34,810 --> 00:02:40,990
I'm also going to make the font size bigger of the top bar so that the font is a little bit easier to

41
00:02:40,990 --> 00:02:41,980
see and read.

42
00:02:42,310 --> 00:02:45,010
And then we're going to also start out with less aliens.

43
00:02:45,010 --> 00:02:46,600
We start out with one aliens.

44
00:02:46,810 --> 00:02:53,650
So this should be fully dynamic and this should give us the flexibility that if we have one alien or

45
00:02:53,650 --> 00:02:56,880
we can have one hundred aliens, whatever we want in the gameplay.

46
00:02:57,250 --> 00:02:58,990
So again, we've got that restart.

47
00:02:59,140 --> 00:03:05,110
And the score didn't update and it did update in the background, but we didn't update the output of

48
00:03:05,110 --> 00:03:05,590
the score.

49
00:03:05,800 --> 00:03:10,600
So again, that's another thing that you do need to make sure that you are taking care of.

50
00:03:10,600 --> 00:03:15,150
So whenever the score changes, you need to update to the new score value.

51
00:03:15,400 --> 00:03:19,020
So this is again resetting that visual stuff for the player.

52
00:03:19,150 --> 00:03:25,450
So over here we're updating and we're outputting the score content using player score, but we're not

53
00:03:25,450 --> 00:03:29,440
doing that in the start of the game and we set up a new score value.

54
00:03:29,560 --> 00:03:32,170
So that means that we need to output it to the player.

55
00:03:32,560 --> 00:03:33,670
So let's try that again.

56
00:03:33,860 --> 00:03:36,880
So now we get a score of one, we restart.

57
00:03:36,880 --> 00:03:38,040
It should go back to zero.

58
00:03:38,680 --> 00:03:40,720
Other thing to notice as well.

59
00:03:41,170 --> 00:03:42,040
So we don't know.

60
00:03:42,400 --> 00:03:44,590
So we have the ability to press the spacebar.

61
00:03:44,830 --> 00:03:46,360
And we saw the fire me.

62
00:03:46,360 --> 00:03:49,090
And then when we restart, we see that it launches.

63
00:03:49,300 --> 00:03:52,300
So that's something else that we need to also reset.

64
00:03:52,600 --> 00:04:00,280
And we were controlling the fire me option here where we were adding in, checking to see if it's true.

65
00:04:00,280 --> 00:04:05,440
And if it is then or if it's not true, then we can add shoot.

66
00:04:05,440 --> 00:04:06,700
Otherwise it's in play.

67
00:04:07,030 --> 00:04:10,120
So the game over really should launch the function.

68
00:04:10,300 --> 00:04:17,980
That doesn't give us the option to click the spacebar and add that fire me so we can set that to fire

69
00:04:17,980 --> 00:04:27,070
me and set it to true and then also take the fire me object and apply a style property to it.

70
00:04:27,220 --> 00:04:33,400
Or we can use class list hide as we've used classless type as we use class list, hide within the ad

71
00:04:33,400 --> 00:04:33,670
shoot.

72
00:04:33,680 --> 00:04:36,520
So this is the one where we're updating the class list.

73
00:04:37,090 --> 00:04:40,690
So you got to be also consistent with how you're updating that.

74
00:04:41,020 --> 00:04:46,120
So the fire me is updating the class and adding in height.

75
00:04:46,120 --> 00:04:47,740
So it's not going to be visible anymore.

76
00:04:47,770 --> 00:04:52,760
And then when we start the game that we can reset the fire me to false.

77
00:04:52,900 --> 00:04:57,850
So that will remove out that fire me from showing up so we don't have that anymore.

78
00:04:58,150 --> 00:05:01,420
And then when we restart the game, we're starting to fire me again.

79
00:05:01,600 --> 00:05:06,400
So again, play through it several times, make sure that you're happy with the functionality that you've

80
00:05:06,400 --> 00:05:06,640
got.

81
00:05:06,640 --> 00:05:10,540
You can also update and tweak some of the variables as needed.

82
00:05:10,950 --> 00:05:12,640
We want the aliens to move faster.

83
00:05:12,820 --> 00:05:16,960
If you want more aliens, the game should be dynamic at this point.

84
00:05:16,960 --> 00:05:19,360
So it should be able to accommodate any number.

85
00:05:19,810 --> 00:05:23,440
And we can see that it's also dependent on the size of your screen.

86
00:05:23,710 --> 00:05:27,580
So if we have twenty aliens on a full sized screen, it's OK.

87
00:05:27,760 --> 00:05:30,190
And you see they are speeding up quite a bit.

88
00:05:30,190 --> 00:05:35,740
They're moving a really, really fast play through it several times, make sure that it's challenging

89
00:05:35,740 --> 00:05:36,070
enough.

90
00:05:36,310 --> 00:05:39,730
And again, you can tweak these values.

91
00:05:39,880 --> 00:05:45,280
You don't have to always increment the speed either as they get hit and ensure that you're providing

92
00:05:45,280 --> 00:05:46,810
a really good user experience.

93
00:05:47,020 --> 00:05:51,430
So coming up next, we'll do a full run through of our gaming application that we've been building.
