The objective of the game is to move the plane and hit the target, and we are going to be creating
a target eventually.
So what we want is the plane to actually automatically be flying in the one direction, incrementing
X all the time.
So it doesn't matter.
Even if the player is pressing X, it'll just speed it up.
But we always have a default value here where we're taking player X.
So before we're out putting it in our left position substate in the style position, we're going to
increment the value of player X and taking our player speed value.
So we try to keep it as dynamic as possible, multiplying it by two.
So what this will do is this will always keep our plane moving.
So always, always, always moving our plane along.
And one of the problems that we immediately see is that it continues to move along and it's passing
over the area where it's supposed to actually be.
So it's moving past our offset area.
So let's do a check for that and that's account for that.
So taking player X and checking to see if it's larger than game area and we'll use that offset width
again to get that last side value, the right side value.
And if it is, then we're taking player X and we're going to set it back to zero.
So this will put the position back.
And we're also going to take the player score because ultimately we want the player to be able to bomb
the position as quickly as possible.
So if he flies by it, if he makes multiple passes, then that's not going to be a good thing.
And also what the score I want to set a default score whenever it starts to 2000.
So we have something to subtract off of.
So now let's try that and press start and we can see that, of course, we're not showing the score
quite yet, but now we can see that the plane is continuously flying.
If I push the right arrow, it goes a little faster.
If I push the left, it slows it down, but it's still always going over to the right hand side.
And that's exactly the movement that we want it to have so that we can have our player score constantly
progressing.
We also want to decrease the score as it takes longer for the player to hit the target.
So we're always going to be decreasing the score constantly.
And then lastly, I don't want the score ever to go less than zero.
So we're going to do a quick check to see if it is less than zero.
And if it is, then we're simply going to take player score and equal it to zero so that we don't ever
go less than zero.
So coming up next, we need to output the score.
So outputting the score and we already set up an area here to output the score.
So it's coming up next.
We'll do some styling to that and output it within our visible area of our gameplay.
So go ahead and add in this automatic movement and start adding in the scoring mechanism as well in
addition to your project.