When you're creating games, you're going to find you're playing through them over and over again until
you finally get the finished product that you were looking for and that you set off to do again to update
some of the styling within the top bar.
So that's where we've got our message and our score setting a height for it.
Width and the width is just going to be 100 percent full across.
So the background color and make the background color black and the font color white and also text the
lines.
So center the text.
So see how that looks.
So now we've got our score at the top and we're ready to play through the game and just get a better
feel for to see if anything's going wrong, if we need to make any final adjustments.
So we've got our start game button.
We've got our ship here.
So that's all visible and a score of zero and we start out so clicking through.
We see we've got five aliens.
We can shoot at the aliens.
And the objective is to get the aliens before they get to the bottom and you can adjust, tweak the
speed of the aliens as needed.
So once you get all of the final aliens, you get you one on within the output and you should also have
the option to start again.
So it didn't finish that finalizing of the gameplay and we can run the same function as we did when
we won where we go through and we reset the game playing.
So if clearing out all of the aliens, so that's another option that we can do.
So we have that function that we set up in order to.
Run the game over and we don't have that over here, but we do have the game over functionality, so
let's add that in.
So instead of just you one, we want to run a game over function, and that's the same one that's going
to reset some of the values and restore our start button so that we can restart the game and play again.
And all it's doing is display, block, restart new game.
You could also output the message here if you wanted to.
So that's another option that you have available.
So again, it is quite a few times that you usually have to play through just to make sure you get all
of the functionality that you want.
And this time we'll try it one more time so we have the ability to restart the game.
We got our score, we got you one and restart the game.
So we start a fresh game.
Notice that the score didn't go back to zero.
So that's one of the thing that we need to take care of and within the player object taking our score.
So that should always go back and reset to zero.
I'm also going to make the font size bigger of the top bar so that the font is a little bit easier to
see and read.
And then we're going to also start out with less aliens.
We start out with one aliens.
So this should be fully dynamic and this should give us the flexibility that if we have one alien or
we can have one hundred aliens, whatever we want in the gameplay.
So again, we've got that restart.
And the score didn't update and it did update in the background, but we didn't update the output of
the score.
So again, that's another thing that you do need to make sure that you are taking care of.
So whenever the score changes, you need to update to the new score value.
So this is again resetting that visual stuff for the player.
So over here we're updating and we're outputting the score content using player score, but we're not
doing that in the start of the game and we set up a new score value.
So that means that we need to output it to the player.
So let's try that again.
So now we get a score of one, we restart.
It should go back to zero.
Other thing to notice as well.
So we don't know.
So we have the ability to press the spacebar.
And we saw the fire me.
And then when we restart, we see that it launches.
So that's something else that we need to also reset.
And we were controlling the fire me option here where we were adding in, checking to see if it's true.
And if it is then or if it's not true, then we can add shoot.
Otherwise it's in play.
So the game over really should launch the function.
That doesn't give us the option to click the spacebar and add that fire me so we can set that to fire
me and set it to true and then also take the fire me object and apply a style property to it.
Or we can use class list hide as we've used classless type as we use class list, hide within the ad
shoot.
So this is the one where we're updating the class list.
So you got to be also consistent with how you're updating that.
So the fire me is updating the class and adding in height.
So it's not going to be visible anymore.
And then when we start the game that we can reset the fire me to false.
So that will remove out that fire me from showing up so we don't have that anymore.
And then when we restart the game, we're starting to fire me again.
So again, play through it several times, make sure that you're happy with the functionality that you've
got.
You can also update and tweak some of the variables as needed.
We want the aliens to move faster.
If you want more aliens, the game should be dynamic at this point.
So it should be able to accommodate any number.
And we can see that it's also dependent on the size of your screen.
So if we have twenty aliens on a full sized screen, it's OK.
And you see they are speeding up quite a bit.
They're moving a really, really fast play through it several times, make sure that it's challenging
enough.
And again, you can tweak these values.
You don't have to always increment the speed either as they get hit and ensure that you're providing
a really good user experience.
So coming up next, we'll do a full run through of our gaming application that we've been building.