WEBVTT

00:01.000 --> 00:08.770
That we have the players shooting moving and they shields as well and can climb missiles with the shields

00:08.770 --> 00:12.540
that start working on the aliens.

00:12.560 --> 00:22.560
So just like we hand with the game player and shields we're going also need to initialise the aliens.

00:22.850 --> 00:33.980
So you actually use your remember the you have a struct called Alien swarm.

00:33.990 --> 00:37.480
So we need to initialize this struct.

00:37.930 --> 00:41.730
So I actually make one swarm

00:44.360 --> 00:48.520
aliens like that.

00:49.530 --> 00:52.690
And let's actually say that.

00:55.370 --> 00:56.230
Aliens

00:58.700 --> 01:04.690
and it's going to take the games as well as the aliens.

01:07.680 --> 01:26.730
So it's clear this turn nothing in it's going to take the game like constant or fruit's and take the

01:26.790 --> 01:27.510
aliens

01:30.220 --> 01:35.970
reference.

01:36.190 --> 01:37.930
It's actually defined this

01:40.630 --> 01:44.420
and define it right after after this

01:49.820 --> 01:50.440
care.

01:50.540 --> 01:54.100
So how would we initialize the alien.

01:55.320 --> 01:59.430
So really we need to set them all to be alive.

01:59.430 --> 02:03.780
If you remember in the alien structure.

02:03.990 --> 02:13.680
We actually said we need to set all the aliens state and we'll need to give it the initial position

02:14.310 --> 02:17.530
and we'll need to use separate size.

02:17.550 --> 02:18.930
All that stuff.

02:19.440 --> 02:21.550
So it's started that.

02:21.560 --> 02:24.480
So first of all that actually set them all to be alive.

02:24.480 --> 02:33.450
So for each row row row is less than a number.

02:33.480 --> 02:34.740
Alien rose

02:37.260 --> 02:39.620
in true cost plus

02:44.800 --> 02:46.880
and remarry we'd find this four.

02:46.900 --> 02:50.480
There's five rows of aliens and 11 columns.

02:53.170 --> 02:56.990
So now let's go through each column

03:04.040 --> 03:06.240
let's remember.

03:06.300 --> 03:13.880
You mean columns plus plus.

03:14.000 --> 03:15.720
And we'll just set them all to be

03:20.850 --> 03:24.950
row column.

03:24.990 --> 03:30.890
So this is the state.

03:31.220 --> 03:33.600
Now they're all alive.

03:33.720 --> 03:38.220
What sets say the direction they're going.

03:40.550 --> 03:44.620
And let's make them go to the right first.

03:47.020 --> 03:56.070
And you have the number of aliens left.

03:56.460 --> 04:04.050
And just how many aliens there are initially.

04:04.130 --> 04:09.240
It's just the number of alien rows and the number in columns

04:14.050 --> 04:16.310
in one set of things.

04:16.340 --> 04:27.550
The animation zero for now we're not going to deal with it in this lecture the size

04:29.870 --> 04:34.830
straight sized with.

04:35.040 --> 04:35.930
We have

04:39.320 --> 04:42.290
we have any constants for this.

04:42.390 --> 04:48.350
Add one or get some so alien.

04:48.510 --> 04:49.450
Right.

04:55.940 --> 05:08.270
Is for right because there's all it there will be actual sprites which we haven't actually made yet.

05:09.060 --> 05:10.900
Yulian spirit

05:13.960 --> 05:15.540
aliens right.

05:17.820 --> 05:18.620
Right.

05:20.160 --> 05:20.680
This to

05:24.220 --> 05:25.260
you mean.

05:25.400 --> 05:26.330
Right.

05:33.830 --> 05:37.860
All right signs start right.

05:40.470 --> 05:41.350
All right.

05:44.280 --> 05:45.070
OK.

05:47.890 --> 05:51.590
So just say the number of bombs.

05:52.560 --> 05:54.210
They zero.

05:55.440 --> 06:06.840
Initialization and let's set the position is it's position so the exposition essentially we want them

06:06.840 --> 06:11.520
to be in the very middle of the screen.

06:11.750 --> 06:13.670
So we're going to say

06:17.210 --> 06:18.540
D-Md..

06:22.430 --> 06:40.140
Size dot with Minus the number of alien columns are eight times the aliens.

06:40.320 --> 06:41.930
Each sprite sized

06:45.040 --> 06:56.470
And so this is how much space the aliens take up minus the actual width of the window and all of this

06:56.470 --> 06:57.170
over to

07:01.200 --> 07:05.040
see see if this is good enough.

07:07.280 --> 07:19.260
And for the aliens dot position why I say the game dot window sized height

07:22.120 --> 07:31.840
Minus the number 18 columns.

07:37.290 --> 07:40.870
Minus well

07:43.700 --> 07:44.800
minus the number.

07:44.800 --> 07:50.120
Alien Rose times the Erian.

07:50.340 --> 07:51.320
Right.

07:54.980 --> 07:57.240
Or say aliens.

07:58.930 --> 08:00.890
Spryte right.

08:03.420 --> 08:09.340
In minus the

08:16.540 --> 08:31.160
alien RWS minus one minus three last game dog level.

08:31.470 --> 08:37.080
So not going to explain this quite yet but we'll see.

08:37.120 --> 08:38.340
Second.

08:39.450 --> 08:43.550
We're also going to say the aliens

08:46.650 --> 08:50.730
line is number.

08:52.400 --> 09:02.470
Columns which is 11 minus game level 1 is.

09:05.270 --> 09:12.310
And so are you aliens dot split end timers.

09:12.400 --> 09:16.040
Now this might change.

09:16.200 --> 09:19.730
We'll see we'll probably make it a revision for this in a second.

09:19.780 --> 09:23.620
Once we actually get everything to be drawing properly.

09:23.810 --> 09:30.850
So let's now let's actually define the sprites of the elite.

09:30.950 --> 09:49.500
It's so x dot each an essay contest Shaar star are going to you do the alien 30 point sprite first.

09:51.350 --> 10:00.580
And if you remember year somewhere thirty point aliens look like this.

10:02.110 --> 10:02.770
OK.

10:03.320 --> 10:06.200
So let's do that.

10:06.210 --> 10:13.510
So it looks like Ford slash two O's and two backslashes.

10:15.320 --> 10:18.180
OK to escape the backslash.

10:18.190 --> 10:19.780
So that's the first part.

10:21.100 --> 10:24.360
And ex-parte is like that.

10:24.600 --> 10:25.240
OK.

10:26.240 --> 10:31.150
And next part is same as the first

10:34.450 --> 10:46.390
in forward slash pack slash coach and another backslash coach and then two backslashes.

10:50.870 --> 10:54.800
There's the first alien

10:57.880 --> 11:02.780
class char you know in the 20 point sprite.

11:10.590 --> 11:13.490
In they're going to look like this.

11:16.570 --> 11:23.040
Space and then the kind of rate freezing angle and the left facing angle brackets.

11:25.070 --> 11:25.970
And then

11:28.910 --> 11:43.880
a solid line two backslashes one forward slash in other recline an vertical line.

11:44.290 --> 11:45.070
This

11:48.380 --> 11:54.920
and Ford slash two spaces actually backslashes.

11:55.440 --> 12:04.990
The pointing point Spryte cuts Chaar star really in ten point separate

12:09.410 --> 12:10.010
so

12:13.740 --> 12:16.790
forward slash to kind of dashes.

12:16.810 --> 12:27.360
And then two back slashes first and then forward slash two spaces two backslashes

12:30.820 --> 12:33.880
and then kind of the same as the first one.

12:35.610 --> 12:43.450
In an angle two spaces angle that connects.

12:43.490 --> 12:46.720
Now we have the sprites for the aliens.

12:50.010 --> 12:51.850
So now let's

12:55.390 --> 12:57.190
actually call

12:59.690 --> 13:03.240
the.

13:03.440 --> 13:08.150
Let's actually implement the Tirah functions for the aliens.

13:11.380 --> 13:13.330
And so in

13:19.320 --> 13:29.850
and we'll say draw game drug games also going to take the aliens now we need to change dreich game to

13:29.990 --> 13:31.630
the aliens.

13:33.620 --> 13:39.570
Such an alien swarm reference it says

13:47.320 --> 13:54.340
US here it's means warm

13:56.920 --> 13:57.220
it's

14:01.370 --> 14:09.070
an now should make a function to actually draw the aliens like we had.

14:09.340 --> 14:21.560
We have a player in shields so let's admit that it's actually clear that Boyd draw aliens

14:23.680 --> 14:27.250
and really it's just going to swarm

14:32.420 --> 14:33.200
reference

14:38.300 --> 14:39.100
capias

14:41.890 --> 14:44.720
and in drug game or you can call it

14:47.870 --> 14:49.320
draw aliens

14:51.870 --> 15:07.580
in this way down here are going to draw.

15:07.760 --> 15:18.370
So now for the drawing essentially need to draw one row of the thirty point aliens.

15:18.460 --> 15:31.830
Or as I say draw one row of the early church you know it's and the next thing we need to do is draw

15:32.280 --> 15:39.990
one row or two rows three of the one point you know it's

15:43.310 --> 15:47.350
and drawn two rows.

15:48.830 --> 15:51.560
Ten point which is

15:55.840 --> 15:56.480
K.

15:56.550 --> 16:05.000
So it's going to be kind of broken up into three different of methods or functions sort of.

16:05.370 --> 16:14.690
So start with the easy one for us is go through all the columns

16:17.090 --> 16:18.270
columns.

16:18.300 --> 16:22.600
It's less than the number of alien columns.

16:25.650 --> 16:26.280
Plus

16:29.480 --> 16:38.740
and we need to get the position things in X equals to aliens.

16:40.560 --> 16:51.870
Position X was column times the aliens dot sprites with

16:55.530 --> 16:56.820
an inch.

16:56.850 --> 16:58.270
Why.

16:58.450 --> 17:03.040
Because x and y position.

17:03.450 --> 17:06.220
This will just be the position of you.

17:06.300 --> 17:13.960
So remember this aliens opposition is the kind of global position of the entire block of alle aliens.

17:14.000 --> 17:29.290
OK so now we should actually we should check if aliens dot the aliens of the first row.

17:30.580 --> 17:35.050
And of current column if they are alive.

17:37.460 --> 17:42.720
Right then we should draw.

17:42.830 --> 17:43.570
Right.

17:46.040 --> 17:59.790
Exposition y position the alien thirty's bright this aliens dot us

18:03.650 --> 18:07.320
that's bright stopped right.

18:12.020 --> 18:25.720
So now it's draw the 20 point is this is all we really have to do for now at least for the three points.

18:25.940 --> 18:32.820
Now we basically need to do the same thing but now we need to draw two rows of these.

18:32.960 --> 18:45.600
So for in our schools zero our is less than is going to make constant comments in each

18:48.670 --> 18:58.010
number of twenty point in roads like this is to

19:00.740 --> 19:03.430
so sure you don't have magic numbers in here.

19:03.430 --> 19:04.470
OK.

19:04.620 --> 19:19.890
So our bus rubbish call it row makes more sense in terms of readability gōde.

19:20.240 --> 19:23.390
And then we'll do the same columns again.

19:36.960 --> 19:48.560
So and now we need to figure out the proper positioning of everything so the exposition will be the

19:48.800 --> 20:01.590
aliens dot position dot X loss column times the aliens the arch sprite sized

20:06.530 --> 20:30.950
and y in stodge position Y plus the row times the aliens dot sized height or sprits size height.

20:32.000 --> 20:35.600
And plus that number of

20:39.870 --> 20:43.020
so and another constant.

20:43.740 --> 20:53.100
Well we're having other conc here and this is going to signify how many rows we have of these three

20:53.800 --> 20:54.690
as well.

20:54.730 --> 21:00.960
Now explain exactly why I'm doing second.

21:06.120 --> 21:07.560
Is that

21:10.360 --> 21:15.470
and times aliens.

21:16.880 --> 21:19.210
Sprits not right.

21:20.940 --> 21:24.060
So essentially what this is saying is

21:27.740 --> 21:31.520
you know this is basically the same thing as here.

21:32.150 --> 21:45.500
So just be after the next bright and this is saying depending on the row like B after the Spryte above

21:45.500 --> 21:50.320
you say so.

21:50.330 --> 21:55.450
So there's one kind of row of sprites above the twenty point aliens right.

21:55.460 --> 21:57.440
This thirty point alians row.

21:57.710 --> 22:03.330
So you have to be kind of below that essentially.

22:03.360 --> 22:06.360
So then we'll just do the exact same thing.

22:11.350 --> 22:13.930
And instead of

22:19.610 --> 22:34.440
instead of zero here we need to say that number of 30 points you mean Rose plus the current row that

22:34.440 --> 22:35.360
you're on.

22:35.700 --> 22:40.030
So it starts at the second row right.

22:40.070 --> 22:46.460
So it's already one rope above you and we go until there's no more rows.

22:46.470 --> 22:51.490
This this type of Balian.

22:51.590 --> 22:54.620
So now the last one

22:57.550 --> 23:02.000
will kind of run it and see how everything looks.

23:02.050 --> 23:06.770
The last one is essentially the same thing.

23:06.810 --> 23:11.460
So I'm going to need another Constance

23:14.100 --> 23:15.180
number 10.

23:15.180 --> 23:16.050
All right.

23:17.640 --> 23:24.680
And it's also to.

23:24.830 --> 23:29.160
So again both through the number of rows for it.

23:41.500 --> 23:46.520
Polls pass through columns in

23:59.280 --> 24:01.780
your column it's

24:05.980 --> 24:09.600
and again the exposition will be essentially the same

24:32.790 --> 24:38.800
and for the y position it'll be a little bit more complicated.

24:39.020 --> 24:44.170
It's going to be alians dot position dot y.

24:46.300 --> 24:50.440
It's our times or road Times

24:52.970 --> 25:01.650
aliens dot right sized height.

25:01.920 --> 25:08.790
And like before then plus the number of thirty point

25:11.380 --> 25:14.500
eighteen Rose times.

25:16.950 --> 25:18.830
Ariens each

25:22.320 --> 25:38.980
sprite sized tight and plus the number of twenty point you time is

25:42.580 --> 25:48.930
right size dot height.

25:49.360 --> 26:02.030
So this is saying like B after the first three rows essentially and and similarly to bar we have to

26:02.030 --> 26:11.590
see aliens dot aliens of number of 30 point

26:16.290 --> 26:24.420
alien RWS plus number of 20 point

26:28.810 --> 26:31.730
Rose plus Roe.

26:31.840 --> 26:32.150
OK.

26:32.160 --> 26:34.350
So again start here.

26:35.170 --> 26:39.670
Started this number of rows because we have two before us.

26:39.670 --> 26:46.510
And then add the current row that were on and same thing as above.

26:47.340 --> 26:52.420
And again the column then was checked to see if this guy is alive.

26:56.560 --> 27:03.220
And if he is we will there should be 20 points right.

27:03.250 --> 27:04.420
Is this

27:07.820 --> 27:11.010
in 10 points right.

27:11.700 --> 27:15.140
So as long as they are alive drop them.

27:15.390 --> 27:17.570
Otherwise dont.

27:17.580 --> 27:20.770
So now that we have all this.

27:20.910 --> 27:24.140
So this is a pretty big function right.

27:24.380 --> 27:27.040
And hopefully it sort of makes sense.

27:27.130 --> 27:30.120
The some changes there is that we have to do

27:32.630 --> 27:39.480
but for the most part I think were good so as to check the aliens.

27:39.490 --> 27:48.450
Yes drug game aliens in dry out aliens is empowerment.

27:48.510 --> 27:52.130
So see what happens.

27:52.340 --> 27:52.700
Its run it

27:56.970 --> 28:03.510
so all was good right.

28:05.110 --> 28:08.930
They look a little too bunched together right.

28:09.870 --> 28:19.350
Theres no kind of padding between them in either the x or y directions.

28:19.350 --> 28:24.790
So let's actually start giving them some padding as well.

28:25.590 --> 28:41.260
So let's Is this an index invaders dot each we should give the aliens some padding.

28:41.400 --> 29:01.050
So we say aliens X padding is one in aliens y patting It's also on.

29:01.210 --> 29:09.820
So let's add some padding into everything so initialize

29:12.520 --> 29:22.380
in the exposition you want to say number of aliens and alien columns times times.

29:22.860 --> 29:24.570
But watch this be

29:27.650 --> 29:28.970
Plus the padding

29:33.220 --> 29:43.490
because we're going to have that amount of padding in in the extraction.

29:43.940 --> 29:55.040
And similarly with the y position we need to say

29:57.950 --> 30:00.120
after the aliens.

30:00.190 --> 30:11.940
I like this aliens spatting that.

30:13.540 --> 30:18.730
And actually and get this wrong this many times this

30:22.630 --> 30:31.630
because it is because there is since there's five alien Rose there should be four rows of padding between

30:31.630 --> 30:32.500
them.

30:32.780 --> 30:35.950
So I miss the four.

30:36.280 --> 30:38.850
So that is OK.

30:38.860 --> 30:45.230
So now it's actually put some padding between the aliens themselves.

30:45.320 --> 30:54.990
So the first road I don't think needs any padding.

30:55.050 --> 31:08.120
OK the next two rows do and in here I was going to say add

31:10.630 --> 31:13.290
Union spatting

31:16.520 --> 31:20.910
aliens expanding right there.

31:21.770 --> 31:31.370
And with the height as well we're going to add the aliens wipe out like that.

31:31.480 --> 31:46.930
K so it's going to do paddings here and also you need the alien paddings hears all

31:54.680 --> 32:02.100
it needs to be in both spots and are to do the same for the next one.

32:42.040 --> 32:53.140
OK so if you're right there's no.

32:53.670 --> 32:57.930
We've got some padding for the first row.

32:59.600 --> 33:06.850
Should be columns times that was the you know it's

33:09.460 --> 33:09.990
expanding

33:16.570 --> 33:20.440
this and you're right it

33:24.270 --> 33:28.760
now we have all the aliens drawing.

33:29.100 --> 33:31.000
And of course it can't hit them yet.

33:35.680 --> 33:37.110
It can't go through

33:40.360 --> 33:49.470
so we're going to actually do some collisions with the aliens in the next lecture.
