WEBVTT

00:01.270 --> 00:06.970
The last part of the game that we're really missing is the alien UFO that we made before.

00:06.970 --> 00:19.820
So over here you have this alien UFO as some random number of points from 50 to 100 or 200 is the size

00:19.820 --> 00:21.690
and position of course.

00:21.860 --> 00:23.770
So we're missing that.

00:23.810 --> 00:30.470
So let's start implementing our alien alien ufo

00:32.950 --> 00:34.420
feel like that.

00:34.660 --> 00:34.940
Kay

00:37.380 --> 00:42.930
and you need to kind of set up the UFO.

00:42.990 --> 00:55.930
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

00:59.790 --> 01:03.930
good to clear up here.

01:04.290 --> 01:08.070
Turn nothing will take the game.

01:10.430 --> 01:18.040
It'll take you.

01:18.210 --> 01:22.390
So here now implemented.

01:30.320 --> 01:43.330
So the first thing is the UFO size and size should be.

01:43.530 --> 01:48.060
I think we actually have those.

01:48.190 --> 01:50.180
We don't find that.

01:50.180 --> 02:00.640
So the UFO alien fo Spryte which is I think it was six or eight

02:04.760 --> 02:09.060
so one two three four five six.

02:09.060 --> 02:11.730
Yes six.

02:11.750 --> 02:25.170
And the alien foes separate height to K and that's also make this right you know.

02:25.230 --> 02:29.900
FO conc star

02:34.070 --> 02:35.700
who's right.

02:38.890 --> 02:39.720
Is

02:46.570 --> 02:51.750
this copy this.

02:51.990 --> 02:57.910
Here in it needs to because it's a backslash right.

02:59.240 --> 03:03.090
And the next one will be the bottom

03:15.580 --> 03:24.180
so the alien phone doesn't have the animations such as the static sprites we have.

03:24.220 --> 03:29.230
So now that we have that info.

03:29.440 --> 03:30.720
Right.

03:33.140 --> 03:41.960
Float Sly's.

03:42.090 --> 03:43.140
All right.

03:50.050 --> 03:51.880
And we.

03:52.030 --> 03:53.370
For the points

03:56.220 --> 04:03.440
cakes can be random from 50 to hundreds Hirose ranch.

04:04.160 --> 04:08.860
Percent are modulus 4.

04:08.880 --> 04:15.130
So this will give a number of between 1 and 0 and 3 Add 1.

04:15.150 --> 04:25.960
So that give us a number between 1 and 4 and I would say times 50 they give us a number between 50 and

04:26.020 --> 04:27.710
200.

04:28.180 --> 04:34.680
And for our position now so be a little bit different than what we did before.

04:34.670 --> 04:38.510
The x will be not in play.

04:38.680 --> 04:39.100
Right.

04:39.180 --> 04:45.030
So your phone only goes in the horizontal direction right.

04:45.070 --> 04:45.650
Right.

04:46.020 --> 04:50.700
So the x will be non-place.

04:50.710 --> 04:58.250
I mean this means no UFO on the screen.

05:00.540 --> 05:02.970
And for the y position

05:06.870 --> 05:11.860
this will be UFO dot sized.

05:11.870 --> 05:14.820
Watch height.

05:17.770 --> 05:28.670
So it will just be kind of two to down from from the top.

05:28.790 --> 05:29.230
OK.

05:31.360 --> 05:39.500
And of course the position again is this is the top left position so it will actually kind of start

05:39.490 --> 05:42.820
started to and then will be

05:45.760 --> 05:57.320
this line so Position wise to be at this line and then three position this position right here.

05:58.890 --> 06:01.560
So.

06:01.750 --> 06:07.140
So that's the Reset the foe.

06:07.210 --> 06:10.200
Now we actually have to make it kind of work.

06:10.230 --> 06:19.270
So go in the woods go back up here.

06:19.380 --> 06:22.070
So we have the alien now set.

06:22.130 --> 06:22.570
OK.

06:22.620 --> 06:28.280
So let's actually have him update itself.

06:28.290 --> 06:35.860
So in a video game we're going to also pass in the UFO this

06:38.450 --> 06:46.270
and to modify the game to pass in FO

06:50.300 --> 06:50.720
So

06:59.320 --> 07:00.850
in your

07:04.800 --> 07:17.210
will say after the after this we'll say if the UFO is not in play.

07:21.470 --> 07:27.980
Then somehow we should put him in play and we don't know how to do that yet.

07:29.760 --> 07:32.850
But you do that second

07:35.420 --> 07:38.250
an otherwise if he is in play.

07:38.310 --> 07:38.850
So

07:41.810 --> 07:45.330
you info in play somehow right.

07:45.330 --> 07:50.720
You don't know how to get in here going to say otherwise he is in play.

07:50.720 --> 07:53.920
So update your.

07:54.430 --> 08:01.460
OK so let's start with this one.

08:01.620 --> 08:04.500
How would we put it in play.

08:04.500 --> 08:08.340
So it really just spawns randomly sometimes.

08:08.400 --> 08:10.120
OK.

08:10.170 --> 08:15.630
So I think what we'll need is in the

08:18.360 --> 08:20.010
game structure

08:22.520 --> 08:32.860
going to put a timer essentially a clock t type in and call it game timer.

08:36.250 --> 08:39.780
And in our

08:42.850 --> 08:48.160
update game I'm going to pass in the delta time that year we have

08:50.750 --> 08:52.250
so here

08:56.620 --> 09:00.910
we have delta times in the past in the function

09:03.670 --> 09:04.610
here.

09:10.400 --> 09:19.820
So all the time and so now I'm passing through that all the time that we have.

09:20.490 --> 09:31.300
And our game timer we're just going to add the depth time each time a new update happens.

09:31.930 --> 09:37.280
So why did I do all that we want to say.

09:37.450 --> 09:46.550
We're going to use it for our calculations so if game timer and again this doesn't matter too much but

09:48.990 --> 09:51.720
this is just kind of a random thing.

09:51.720 --> 09:59.760
So if the modulus is equal to say 13.

09:59.860 --> 10:06.830
So if we take the game time the current game time and we model this by 500 and that somehow equals to

10:06.850 --> 10:10.730
13 then we'll put the actual your phone in play.

10:10.750 --> 10:18.220
So was going to say put UFO play.

10:18.310 --> 10:25.210
So I was just kind of random It doesn't really doesn't really matter how you put it in play or how you

10:25.210 --> 10:26.590
decide to put it in play right.

10:26.590 --> 10:27.970
This is what we're doing.

10:27.970 --> 10:31.970
We're deciding whether or not we should play or not.

10:32.180 --> 10:35.620
You can you can come up with your own formula if you want.

10:35.750 --> 10:43.550
This is the one I'm going to be using and we find error reviews of function that we don't have yet.

10:43.760 --> 10:55.320
Just call or call the put your phone in play and take the game and the UFO so otherwise we're going

10:55.320 --> 11:02.260
to say if if we've actually hit the

11:05.590 --> 11:11.100
layered missile and the folks photoshopped Zeeshan

11:14.030 --> 11:16.360
dot size.

11:16.650 --> 11:19.070
So we made this function before.

11:19.110 --> 11:27.160
So that was an I think it was in the aliens collision or something.

11:27.610 --> 11:32.550
So if we actually hit the UFO then we should get the points right.

11:33.620 --> 11:38.390
Layered score get the points that Phil has

11:41.230 --> 11:43.730
and the missile should be set

11:49.300 --> 11:51.700
and we should reset the UFO as well.

11:56.920 --> 11:57.720
OK.

11:58.220 --> 12:07.130
Otherwise we should update the UFO to actually keep going across the screen so we're going to call that

12:07.130 --> 12:08.130
update you know

12:11.580 --> 12:13.460
and we don't have this function yet.

12:13.500 --> 12:22.120
So we need to add two new functions called Put your play and update your phone.

12:22.130 --> 12:26.300
So let's start with we put your phone in play.

12:26.410 --> 12:39.840
So be very simple.

12:40.230 --> 12:50.280
She's game and all.

12:50.600 --> 12:52.840
Copy this down here.

12:56.500 --> 13:06.640
See your phone and play and really all this will do is we'll set the position easier.

13:06.650 --> 13:11.040
So it's always going to start at the left side of the screen.

13:12.160 --> 13:21.170
So that's really it you could decide and I'll leave this up to you if you want to somehow maybe spawn

13:21.170 --> 13:24.760
it at the right side of the screen and have it go left.

13:24.880 --> 13:27.760
You could try that as well.

13:27.870 --> 13:31.060
I'm just going to always go from left to right in this one.

13:31.150 --> 13:35.770
But if you want to change it yourself go right ahead.

13:35.860 --> 13:41.210
So we're also going to define update.

13:43.430 --> 13:44.960
Cleared up here.

13:51.140 --> 13:53.020
It'll take game

14:11.700 --> 14:12.200
like that.

14:17.570 --> 14:27.330
So let's implement the FO.

14:27.360 --> 14:31.730
So the update should be really simple.

14:31.890 --> 14:35.160
Basically we're just going to say his exposition

14:37.890 --> 14:41.010
equals 1.

14:41.720 --> 14:42.350
That's it.

14:43.950 --> 14:49.050
And if the position

14:52.050 --> 14:57.420
plus the position to X plus the foe's size

14:59.890 --> 15:12.610
each with if that's greater than or equal to the game's window size so if the right most edge of the

15:13.970 --> 15:22.170
of the UFO is greater than or equal to the window size then we'll just make him disappear.

15:22.200 --> 15:24.780
So scary set of

15:36.180 --> 15:38.260
so pretty simple.

15:38.580 --> 15:44.010
And we're also going to need to be able to draw a ring that.

15:44.060 --> 15:56.160
So down here and I say draw your foe and each pass in the game but you don't need it.

15:57.000 --> 15:59.420
Really.

16:01.420 --> 16:05.900
Actually no we actually don't need to game.

16:05.930 --> 16:09.090
So you can say alian you fo

16:11.740 --> 16:24.860
fold this and if it's in play is if you fold up position and much x is not equal to 9 way

16:31.730 --> 16:33.470
and we'll draw this right.

16:36.280 --> 16:37.520
Proper position

16:47.920 --> 16:52.160
in.

16:52.300 --> 16:53.090
Right.

16:55.390 --> 16:56.540
Union.

16:56.670 --> 16:57.200
Right.

16:57.250 --> 16:59.040
CH Right.

17:07.010 --> 17:07.870
To call.

17:07.930 --> 17:09.050
That's right.

17:13.370 --> 17:15.100
That's right.

17:49.370 --> 17:52.570
OK we'll see.

17:52.580 --> 18:04.170
Now for the draw you fo in our you know our draw

18:08.390 --> 18:21.270
you know our Drog game are also going to pass in the.

18:21.360 --> 18:22.720
I actually think you know it's wrong.

18:22.720 --> 18:24.130
That's right.

18:24.340 --> 18:24.850
This

18:28.550 --> 18:30.230
should not exist.

18:32.430 --> 18:35.940
Sometimes things just occur to you when you're not even thinking about it.

18:36.510 --> 18:36.820
OK.

18:36.840 --> 18:45.650
So anyway the impasse pass in the your phone to draw the game in game passing you know

18:50.490 --> 18:53.320
here an update.

18:53.320 --> 18:58.840
So in here I'll say also Colts in

19:04.690 --> 19:09.820
that in trot down here.

19:09.920 --> 19:16.650
So if the well what do you say draw.

19:18.570 --> 19:19.210
In

19:23.040 --> 19:27.670
K so that's basically it's

19:30.370 --> 19:31.160
run this

19:50.720 --> 19:51.520
position.

19:51.600 --> 19:53.050
Sorry that

20:06.680 --> 20:11.260
no he probably didn't declare the draw you know.

20:11.310 --> 20:13.780
Yeah do that.

20:14.010 --> 20:14.280
So

20:18.800 --> 20:19.420
now this

20:23.700 --> 20:24.240
so

20:27.610 --> 20:28.450
is killed.

20:28.520 --> 20:34.550
So it's just hanging out under the shelter and hopefully hopefully the fall will just kind of appear

20:36.110 --> 20:37.430
and it's totally random.

20:37.430 --> 20:44.770
So one thing we might want to do is make the make it up on there it is.

20:44.800 --> 20:48.420
So I see it disappears.

20:48.420 --> 20:50.380
OK.

20:51.110 --> 20:51.970
So that's good.

20:54.200 --> 21:02.290
And if I can get it to appear again and actually hit it that awesome.

21:02.630 --> 21:07.430
I don't want to waste too much time.

21:07.590 --> 21:08.430
There it is.

21:08.530 --> 21:10.150
See if I can hit it.

21:10.460 --> 21:11.190
Yes.

21:11.260 --> 21:12.740
I got 200 points there.

21:13.030 --> 21:15.200
So that's working as well.

21:15.260 --> 21:16.900
So awesome.

21:16.930 --> 21:24.660
So there is the UFO and all really the major gameplay is working.

21:24.820 --> 21:30.520
The last thing I want to do we could actually stop this game right now and that would be pretty good

21:30.940 --> 21:39.640
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

21:39.760 --> 21:45.130
name be actually registered in the score table and good luck.

21:45.220 --> 21:47.710
Reload it from from a file.

21:47.800 --> 21:48.370
OK.

21:48.580 --> 21:53.120
So that's what we're going to concentrate on in the next lecture.
