The last part of the game that we're really missing is the alien UFO that we made before.
So over here you have this alien UFO as some random number of points from 50 to 100 or 200 is the size
and position of course.
So we're missing that.
So let's start implementing our alien alien ufo
feel like that.
Kay
and you need to kind of set up the UFO.
So I'm going to call it set up method reset UFO and it's going to take game in it's going to take UFO
good to clear up here.
Turn nothing will take the game.
It'll take you.
So here now implemented.
So the first thing is the UFO size and size should be.
I think we actually have those.
We don't find that.
So the UFO alien fo Spryte which is I think it was six or eight
so one two three four five six.
Yes six.
And the alien foes separate height to K and that's also make this right you know.
FO conc star
who's right.
Is
this copy this.
Here in it needs to because it's a backslash right.
And the next one will be the bottom
so the alien phone doesn't have the animations such as the static sprites we have.
So now that we have that info.
Right.
Float Sly's.
All right.
And we.
For the points
cakes can be random from 50 to hundreds Hirose ranch.
Percent are modulus 4.
So this will give a number of between 1 and 0 and 3 Add 1.
So that give us a number between 1 and 4 and I would say times 50 they give us a number between 50 and
200.
And for our position now so be a little bit different than what we did before.
The x will be not in play.
Right.
So your phone only goes in the horizontal direction right.
Right.
So the x will be non-place.
I mean this means no UFO on the screen.
And for the y position
this will be UFO dot sized.
Watch height.
So it will just be kind of two to down from from the top.
OK.
And of course the position again is this is the top left position so it will actually kind of start
started to and then will be
this line so Position wise to be at this line and then three position this position right here.
So.
So that's the Reset the foe.
Now we actually have to make it kind of work.
So go in the woods go back up here.
So we have the alien now set.
OK.
So let's actually have him update itself.
So in a video game we're going to also pass in the UFO this
and to modify the game to pass in FO
So
in your
will say after the after this we'll say if the UFO is not in play.
Then somehow we should put him in play and we don't know how to do that yet.
But you do that second
an otherwise if he is in play.
So
you info in play somehow right.
You don't know how to get in here going to say otherwise he is in play.
So update your.
OK so let's start with this one.
How would we put it in play.
So it really just spawns randomly sometimes.
OK.
So I think what we'll need is in the
game structure
going to put a timer essentially a clock t type in and call it game timer.
And in our
update game I'm going to pass in the delta time that year we have
so here
we have delta times in the past in the function
here.
So all the time and so now I'm passing through that all the time that we have.
And our game timer we're just going to add the depth time each time a new update happens.
So why did I do all that we want to say.
We're going to use it for our calculations so if game timer and again this doesn't matter too much but
this is just kind of a random thing.
So if the modulus is equal to say 13.
So if we take the game time the current game time and we model this by 500 and that somehow equals to
13 then we'll put the actual your phone in play.
So was going to say put UFO play.
So I was just kind of random It doesn't really doesn't really matter how you put it in play or how you
decide to put it in play right.
This is what we're doing.
We're deciding whether or not we should play or not.
You can you can come up with your own formula if you want.
This is the one I'm going to be using and we find error reviews of function that we don't have yet.
Just call or call the put your phone in play and take the game and the UFO so otherwise we're going
to say if if we've actually hit the
layered missile and the folks photoshopped Zeeshan
dot size.
So we made this function before.
So that was an I think it was in the aliens collision or something.
So if we actually hit the UFO then we should get the points right.
Layered score get the points that Phil has
and the missile should be set
and we should reset the UFO as well.
OK.
Otherwise we should update the UFO to actually keep going across the screen so we're going to call that
update you know
and we don't have this function yet.
So we need to add two new functions called Put your play and update your phone.
So let's start with we put your phone in play.
So be very simple.
She's game and all.
Copy this down here.
See your phone and play and really all this will do is we'll set the position easier.
So it's always going to start at the left side of the screen.
So that's really it you could decide and I'll leave this up to you if you want to somehow maybe spawn
it at the right side of the screen and have it go left.
You could try that as well.
I'm just going to always go from left to right in this one.
But if you want to change it yourself go right ahead.
So we're also going to define update.
Cleared up here.
It'll take game
like that.
So let's implement the FO.
So the update should be really simple.
Basically we're just going to say his exposition
equals 1.
That's it.
And if the position
plus the position to X plus the foe's size
each with if that's greater than or equal to the game's window size so if the right most edge of the
of the UFO is greater than or equal to the window size then we'll just make him disappear.
So scary set of
so pretty simple.
And we're also going to need to be able to draw a ring that.
So down here and I say draw your foe and each pass in the game but you don't need it.
Really.
Actually no we actually don't need to game.
So you can say alian you fo
fold this and if it's in play is if you fold up position and much x is not equal to 9 way
and we'll draw this right.
Proper position
in.
Right.
Union.
Right.
CH Right.
To call.
That's right.
OK we'll see.
Now for the draw you fo in our you know our draw
you know our Drog game are also going to pass in the.
I actually think you know it's wrong.
That's right.
This
should not exist.
Sometimes things just occur to you when you're not even thinking about it.
OK.
So anyway the impasse pass in the your phone to draw the game in game passing you know
here an update.
So in here I'll say also Colts in
that in trot down here.
So if the well what do you say draw.
In
K so that's basically it's
run this
position.
Sorry that
no he probably didn't declare the draw you know.
Yeah do that.
So
now this
so
is killed.
So it's just hanging out under the shelter and hopefully hopefully the fall will just kind of appear
and it's totally random.
So one thing we might want to do is make the make it up on there it is.
So I see it disappears.
OK.
So that's good.
And if I can get it to appear again and actually hit it that awesome.
I don't want to waste too much time.
There it is.
See if I can hit it.
Yes.
I got 200 points there.
So that's working as well.
So awesome.
So there is the UFO and all really the major gameplay is working.
The last thing I want to do we could actually stop this game right now and that would be pretty good
but I kind of got to go one extra step and I want to be able to have a high score table and have your
name be actually registered in the score table and good luck.
Reload it from from a file.
OK.
So that's what we're going to concentrate on in the next lecture.