WEBVTT

00:00.670 --> 00:07.960
Know we've implemented most of the data we're going to need and kind of thought about it a little bit

00:08.020 --> 00:13.090
at least we're going to start actually implementing the game.

00:13.120 --> 00:20.100
So let's go to our main function right now a world here.

00:20.270 --> 00:21.190
Move this

00:23.930 --> 00:25.090
so.

00:26.210 --> 00:30.770
And first we're going to need to include

00:33.440 --> 00:35.450
text invader's.

00:35.530 --> 00:36.130
Each

00:39.900 --> 00:42.240
because we're going to need all this data.

00:42.410 --> 00:44.710
All of these definitions.

00:46.660 --> 00:54.720
And we're going to need our curses you tale's.

00:55.700 --> 00:58.210
So that's good for now.

00:59.030 --> 01:10.170
And now let's let's really just start with the main loop ok and or the main function in general.

01:10.250 --> 01:17.880
So we know we're going to need our game object that we made in TX in meters.

01:18.000 --> 01:18.740
H.

01:18.800 --> 01:19.990
This.

01:20.090 --> 01:31.300
And let's just start with the player as well and add extra extra variables of different types like the

01:31.310 --> 01:35.040
yelling swarm in the phone and all that later.

01:35.130 --> 01:35.610
OK.

01:36.390 --> 01:39.920
So what would we need to do.

01:40.050 --> 01:46.390
So we'll probably need some function to initialize the games.

01:46.390 --> 01:52.490
And when I say it's called in game and I'm going to give it again.

01:52.830 --> 02:01.340
And most are going to need something to get the player call it player and give it the player.

02:01.370 --> 02:09.080
So this in that game will kind of set up like all the data so that the window size and the level and

02:09.080 --> 02:17.720
the current state of that and and that player will you know set the initial position in missile and

02:17.870 --> 02:19.570
the size and stuff.

02:19.570 --> 02:19.940
OK.

02:21.850 --> 02:26.430
So what's right those functions.

02:26.810 --> 02:28.900
It's not her attorney thing.

02:28.910 --> 02:43.980
So in a game first in a passing game by reference and intimately with the pair going to say layer by

02:43.980 --> 02:44.850
reference

02:47.520 --> 02:51.960
that's ancient you implement them.

02:51.960 --> 02:53.240
Pretty simple for now.

02:58.940 --> 03:01.750
That K..

03:01.870 --> 03:18.610
So for game really you just need to say let's initialize the window size so you get is we actually use

03:18.950 --> 03:24.850
cursus utils So we're actually going to get the screen.

03:25.370 --> 03:32.090
And use the screen with the function and the screen height function screen

03:37.040 --> 03:37.900
like that.

03:38.040 --> 03:44.240
And I was going to set the height as well

03:50.950 --> 04:04.180
and the level is put in one initially in the current state is going to be rocking to make it be the

04:04.180 --> 04:09.230
intro yet we're actually going to make it be placed first.

04:09.270 --> 04:10.090
OK.

04:10.450 --> 04:15.980
And the reason why we're going to do that so you look into here.

04:16.300 --> 04:25.380
I typically try to start with the most kind of common case that the player is going to be in.

04:25.390 --> 04:25.710
Right.

04:25.720 --> 04:28.920
So most of the time is going to be playing games.

04:28.990 --> 04:29.380
Right.

04:29.380 --> 04:34.570
So and really that's the most important part of the game is actually playing.

04:34.620 --> 04:34.970
Right.

04:34.990 --> 04:41.460
So I'm going to start the game currently in the police state.

04:43.080 --> 04:44.960
But this will have to change.

04:44.960 --> 04:47.460
So when you say to do

04:49.740 --> 04:55.080
change shoe Yes intro

04:57.890 --> 04:58.170
you

05:03.890 --> 05:05.490
have to do that later.

05:05.490 --> 05:10.890
But for now it's going to start in the play station kind of mess around.

05:10.980 --> 05:17.340
So the player then should be fairly simple.

05:18.620 --> 05:24.560
Where dots say his position

05:27.850 --> 05:34.950
or actually right to say his lives and he lives from last time.

05:35.100 --> 05:40.160
I didn't actually set them to zero but I said to him to be three but they should be.

05:40.830 --> 05:59.030
Copy this and say x number of lies lies the are going to set the right size to be some size so we don't

05:59.270 --> 06:00.800
have any constants for this.

06:00.810 --> 06:10.490
Let's make it so the right size we said in here would be where is Chubais 5.

06:11.810 --> 06:14.710
So set something here.

06:16.370 --> 06:18.200
Where Spryte

06:21.760 --> 06:22.070
with

06:25.460 --> 06:41.880
is five in the player separate height is two k so it's two rows for the height Zaine five columns with

06:41.880 --> 06:46.460
the width and scope and he's

06:51.180 --> 06:51.990
height.

06:51.990 --> 06:52.720
Is this

06:55.330 --> 07:01.440
and size that.

07:01.510 --> 07:04.970
Sorry that's OK.

07:07.350 --> 07:22.680
And I'm also going to set the position of the where and I'm actually going to make a new function for

07:22.680 --> 07:41.070
this stuff and I'm going to call it teach reset where it's where it's going to take the player in that.

07:41.220 --> 07:51.120
And the reason why I am doing this and also do is do more initialising but every time we kind of change

07:51.520 --> 07:58.230
I say to the next level we want to kind of recenter the player and put him in the initial spot and stuff

07:58.230 --> 07:59.270
like that.

07:59.640 --> 08:07.920
So we might need to call this a bunch of times unlike this nit player which we only will call once per

08:08.400 --> 08:09.130
game.

08:09.150 --> 08:09.860
Right.

08:10.260 --> 08:14.420
So I mean we don't really have to set his width and height every time.

08:14.430 --> 08:18.210
OK so we're going to say a reset player here.

08:24.200 --> 08:31.100
So and reset player will actually set where the player should be initially.

08:31.100 --> 08:39.940
So it's position X is going to be in actually going to.

08:40.430 --> 08:46.100
I'm going to need the game with stuffs because I need to center him properly.

08:46.100 --> 08:54.960
So in fact we have to do our first revision which is send in the games.

08:55.070 --> 08:58.040
So the second change

09:03.830 --> 09:11.120
animals to me to get here is wow I'm just putting the game first.

09:11.360 --> 09:18.170
Just because no reason way.

09:18.610 --> 09:19.590
Copy this

09:22.070 --> 09:23.850
there.

09:24.040 --> 09:26.050
Copy that and put it there.

09:26.740 --> 09:27.780
And then that player.

09:27.790 --> 09:30.300
I'm also going to pass in the game.

09:30.820 --> 09:40.070
So again the reason I need that is because when you do this so with a size Dortch

09:43.350 --> 10:05.190
the went over to minus the player dot the sprite size player that went over to Canute's this puts the

10:05.190 --> 10:11.030
player in center screen.

10:13.480 --> 10:22.040
Horizontal.

10:22.200 --> 10:29.540
And we're also going to put the player position.

10:30.120 --> 10:38.090
Why is what CH It will need to be at the bottom of the screen.

10:38.590 --> 10:46.590
OK but I want him to be one kind of row up from the screen at the bottom.

10:46.620 --> 10:53.460
So it's a game daunts window sized height.

10:53.490 --> 11:00.660
And I remember that it goes from 0 0 at the top left of the screen down.

11:00.690 --> 11:10.580
So you're going to have to take the height of the window minus the player sprite size

11:13.530 --> 11:20.140
dot hige OK so the heights can be two and the window size.

11:20.360 --> 11:23.830
Dr. Height is 30.

11:24.030 --> 11:29.770
So he'll be eight down minus 1.

11:29.790 --> 11:31.770
So that's kind of where he'll start.

11:33.510 --> 11:40.610
And you'll see you'll see what this really do a bit as gain here.

11:40.620 --> 11:42.410
So.

11:42.860 --> 11:51.910
So the other thing you need to do is get the players and the nation states in or at zero initially set

11:52.590 --> 12:00.340
and are also going to need to set the missile position as well.

12:00.340 --> 12:10.000
And we need to somehow say whether or not the missile is currently in play.

12:10.060 --> 12:18.610
So I'm actually going to make a couple of new constants or one new concept really.

12:19.440 --> 12:26.390
And I'm going to name it's not in play in a safe.

12:26.400 --> 12:40.000
Negative One copy this and I'm actually going to make a new function for this as well.

12:40.740 --> 12:47.580
And I'm going to call it void resets missile

12:50.060 --> 12:51.980
and give it player

12:56.200 --> 12:57.020
so.

12:57.520 --> 13:02.540
And what recent missile will do is actually take it out of play.

13:04.720 --> 13:12.790
So we're going to need this for when you hit an alien or hit shield or something like that or goes off

13:12.790 --> 13:14.200
screen.

13:14.410 --> 13:17.330
It's going to need to go out of play.

13:17.350 --> 13:30.190
So risk where Dot missile dot X is not les.

13:30.220 --> 13:38.540
And similarly with the y it's not it's play right because he hasn't shot yet.

13:38.550 --> 13:46.040
So this makes sense and in recent missile.

13:46.230 --> 13:48.930
So we haven't even drawn anything or done anything yet.

13:48.930 --> 13:53.730
We're just just initialize the player.

13:53.740 --> 13:56.120
And again that's it.

13:56.440 --> 14:06.890
OK so now let's actually do the main loop.

14:06.890 --> 14:16.990
So we have we've initialized the player and the game so to say you'll quit and do the same kind of thing

14:16.990 --> 14:21.390
that we did for a while not quit.

14:24.960 --> 14:33.840
What we're going to do is get the in touch or handle the input of the player.

14:33.840 --> 14:40.380
So we're going to need that function for this a handle input

14:43.400 --> 14:48.260
and maybe it'll pass back the input that you gave it.

14:50.900 --> 14:57.690
And I say we're a good game in order to get with the player.

14:58.950 --> 15:02.030
And you'll see why it's an SOS.

15:02.040 --> 15:02.960
Copy this

15:10.450 --> 15:19.240
this second copy it is a little input and turn that character.

15:19.300 --> 15:26.040
It's going to take a game.

15:26.560 --> 15:30.580
It can change the game at all but we might change the player

15:33.760 --> 15:34.300
so

15:39.990 --> 15:49.090
in which copy this piece down here we're not even really going to implement that.

15:49.170 --> 16:00.300
So I was going to do this now in declare clear input that we're going to implement yet.

16:00.590 --> 16:09.230
All really we're going to do from now on is try to get the player to draw in maybe move later.

16:09.350 --> 16:14.220
OK so we're going to have the player on the screen and maybe he'll move.

16:14.990 --> 16:18.000
So that's it for that for now.

16:18.080 --> 16:19.970
And we're going to do

16:24.850 --> 16:27.670
I guess we'll go where we'll do.

16:29.890 --> 16:33.630
Well one thing we haven't done is actually initially curse.

16:33.730 --> 16:37.680
So we should actually do that.

16:38.650 --> 16:45.640
Function is called Schley's versus So we could actually do this right away.

16:45.640 --> 16:50.580
True because we want Nodaway in our gets shut down

16:53.380 --> 16:54.390
curses here.

16:55.400 --> 16:55.960
OK.

16:56.450 --> 16:58.460
So go do that.

16:58.490 --> 17:00.850
It's very import.

17:00.910 --> 17:05.630
So now we will

17:08.140 --> 17:11.200
I guess for now we'll say update game

17:14.020 --> 17:21.190
and we'll pass the game and the player for now and we'll say clear the screen.

17:24.500 --> 17:29.450
And this comes from is used Hill's.

17:30.160 --> 17:43.730
And we'll say draw the game using the game and the player and say refresh the screen also from curses

17:43.920 --> 17:45.060
he tells.

17:45.330 --> 17:46.720
OK.

17:46.740 --> 17:58.920
So let's start implementing these a little bit so update game we're not going to implement really yet

17:58.970 --> 17:59.680
anyway.

18:00.750 --> 18:12.320
So soccer or anything in this I don't think we're going to change it but maybe that's not the case.

18:12.320 --> 18:18.860
We we might change the player and we're also going to need Drog game

18:22.600 --> 18:29.440
and we're definitely not going to change the game again and are not going to change.

18:31.180 --> 18:31.620
Damier

18:34.670 --> 18:42.790
OK so you'd have a lot of functions none of which really have been all implemented yet except for maybe

18:42.790 --> 18:43.780
the initialize ones

18:47.560 --> 18:52.470
so start implementing a little bit of it.

18:52.630 --> 18:57.770
So probably not going to implement a game yet.

18:59.530 --> 19:06.280
Says something to update we just want the player to kind of be on screen.

19:07.170 --> 19:14.930
So we don't have a sprite yet and this semicolon right there.

19:15.070 --> 19:16.800
We don't have a straight for the player.

19:16.810 --> 19:21.510
So let's actually go back and make him.

19:21.910 --> 19:23.560
Let's actually make this right.

19:29.400 --> 19:35.060
So let's call him that's going to accounts char star.

19:35.220 --> 19:35.680
Right.

19:35.700 --> 19:47.040
So Aski so I can call him player Spryte and he's going to be it's going to be an array and each element

19:47.040 --> 19:47.790
will be

19:50.450 --> 19:57.550
kind of see strings sort of and this will be his top it will be firsts.

19:57.640 --> 20:04.520
The top part of him and this will be the bottom that day.

20:04.760 --> 20:10.170
It's an array of character pointers.

20:10.220 --> 20:14.020
So now we have the player Spryte.

20:14.030 --> 20:25.750
So now we should ask into here and we're have to figure out how to draw the player.

20:27.750 --> 20:30.390
So how are we going to

20:33.140 --> 20:34.540
draw the player.

20:35.940 --> 20:46.040
Well in general Burgess going to need some way of drying sprite k.

20:46.370 --> 20:56.840
So I'm actually going to instead of drawing or having like draw sprite method in TX invader's actually

20:56.840 --> 21:00.140
going to put it in curses.

21:00.170 --> 21:06.410
This is kind of the missing function that I was kind of talking about before.

21:06.770 --> 21:12.320
So we're actually going to say void draw Spryte

21:14.760 --> 21:25.240
and redraw it at some positions exposition in y position and or indeed the Spryte self.

21:25.610 --> 21:31.100
Or star Spryte and are going to need the height of this right.

21:31.100 --> 21:35.060
Really this is kind of the length of the array.

21:37.440 --> 21:44.920
And I'm also going to add we're going to add an offset.

21:46.090 --> 21:50.910
Here and this is going to be for later.

21:50.980 --> 21:53.700
And actually going to make it the default parameter.

21:53.740 --> 21:55.580
So are you going there.

21:56.140 --> 21:56.710
Yeah.

21:57.050 --> 22:05.260
These kind of defaulted parameters and then defaulted to zero and you'll see why we need this function

22:05.260 --> 22:06.280
probably

22:09.740 --> 22:17.260
probably we're going to need this function later when we do this parameter later when we do aliens.

22:17.270 --> 22:27.390
But for now I'm going to leave it there to the Dutch CVP file for curses.

22:28.920 --> 22:33.800
Remerge the fault parameters we don't need to have the actual value here.

22:34.940 --> 22:47.320
So that and really what we're going to do for the draw Spryte is pretty simple screens say for each

22:47.320 --> 22:51.860
so inch each being the height height is less than

22:54.890 --> 22:55.870
Spryte height.

22:59.580 --> 23:00.850
Each plus plus.

23:00.950 --> 23:04.990
So it's going to go through each step go back to here.

23:06.540 --> 23:15.160
For each kind of row right height is in the rows we just kind of draw this string.

23:15.170 --> 23:15.650
OK.

23:16.680 --> 23:25.780
That's basically so act here.

23:25.980 --> 23:26.790
Say

23:31.630 --> 23:33.760
and just sit on.

23:35.310 --> 23:39.110
Grass say envied in the branch you

23:43.660 --> 23:49.640
say why position plus the height

23:52.010 --> 23:55.380
and the exposition.

23:55.620 --> 24:01.190
And we're going to say the Spryte of each

24:11.740 --> 24:24.810
Well actually we're going to do S. S. that and this present s actually means a C string.

24:25.240 --> 24:29.790
And this is actually what's called a format format string.

24:29.830 --> 24:34.780
So we actually have to give it the format string in order to draw it properly.

24:34.830 --> 24:35.460
OK.

24:35.980 --> 24:38.470
So just follow follow this.

24:38.470 --> 24:40.360
This just means string.

24:40.570 --> 24:44.780
So put a string in here and this is the string that we're going to put.

24:44.900 --> 24:46.720
OK that's it.

24:46.750 --> 24:49.320
And we'll deal with the offsets later.

24:49.410 --> 24:50.140
OK.

24:50.340 --> 24:52.890
It's not going to bother with yet.

24:52.960 --> 25:01.600
So now that we have something to draw the sprite Let's actually draw the player draw straight

25:05.660 --> 25:10.670
so and take the exposition

25:14.390 --> 25:16.020
in the y position.

25:22.480 --> 25:32.400
And the actual Spryte itself is going to say play or straight.

25:33.250 --> 25:45.860
And B and each so layered that Sprite sized right that

25:49.360 --> 25:52.420
so you truly are in

25:56.790 --> 25:57.570
was right.

25:57.610 --> 25:58.180
Right.

26:01.820 --> 26:14.450
Offset each.

26:14.650 --> 26:21.500
Now where did you draw this.

26:21.600 --> 26:21.960
I

26:25.710 --> 26:29.650
may have put in actual curses you do for some reason.

26:30.060 --> 26:30.670
OK.

26:30.740 --> 26:43.430
So let's make sure make sure I always still kind of like do this and remove all all your your old files

26:43.730 --> 26:46.330
sure that you're putting in the right one.

26:48.300 --> 26:52.020
So I think that's ok now.

26:52.900 --> 26:53.500
OK.

26:53.940 --> 26:57.050
So rest is averted are good.

26:57.280 --> 27:01.220
So now this work.

27:01.240 --> 27:08.000
So let's actually run this and see what happens.

27:11.330 --> 27:12.030
Exist

27:24.930 --> 27:30.680
missing missing that.

27:30.780 --> 27:38.090
So so there should be an array of const char stores.

27:38.100 --> 27:38.870
OK.

27:39.290 --> 27:42.570
So that's all that was.

27:42.570 --> 27:50.970
So now this Yes and look we have our player right.

27:51.080 --> 27:52.360
OK.

27:52.590 --> 27:57.860
So now that we actually have something drawing on the screen which is nice.

27:58.170 --> 28:02.170
Let's actually get to moving him.

28:02.320 --> 28:04.500
Let's close this

28:07.560 --> 28:13.160
and start implementing the handle inputs.

28:13.260 --> 28:30.910
So here now we basically want to do kind of a switch over the input and see what's and see kind of what

28:30.910 --> 28:34.630
was done by the player.

28:34.690 --> 28:35.090
OK.

28:35.170 --> 28:40.310
So I'm going to also say if you hit Q Then you want to quit.

28:40.480 --> 28:44.070
So we will say switch

28:47.770 --> 28:54.180
and we'll switch over the char.

28:54.300 --> 29:05.970
And in fact we'll say actually say it or not we don't want this to be a charge of this to be in this

29:08.170 --> 29:08.660
fact.

29:08.750 --> 29:11.340
This is all.

29:11.520 --> 29:15.400
And the reason again is for the Iraqis.

29:16.320 --> 29:27.360
So we'll say input schools get our char and get charges from the details.

29:27.600 --> 29:28.820
Curses.

29:28.940 --> 29:30.460
So it's details.

29:30.600 --> 29:34.840
But and we'll switch over it.

29:34.840 --> 29:36.620
So if it's.

29:36.850 --> 29:37.450
Q

29:40.050 --> 29:42.530
Then we'll just return

29:48.630 --> 29:51.810
the input like that.

29:52.710 --> 29:59.860
If it's the arrow key so take a look at this.

30:00.010 --> 30:01.570
And in fact I'm going to change this.

30:01.670 --> 30:02.380
AK

30:04.950 --> 30:05.810
for air.

30:05.830 --> 30:08.770
You want to keep consistent naming here.

30:14.100 --> 30:17.340
That flip in the right place.

30:18.030 --> 30:25.530
So if it's the actual arrow key and for now we're going to do left

30:28.310 --> 30:33.310
that will do something at.

30:33.560 --> 30:38.460
Or if it's right is something.

30:38.630 --> 30:43.200
So really it's going to be moved to the right to left.

30:44.450 --> 30:46.900
And that's it.

30:48.870 --> 30:49.800
So

30:52.590 --> 30:57.480
let's actually run this one more time to make sure that cue works.

30:57.540 --> 31:01.800
It doesn't because we haven't hooked up yet.

31:01.800 --> 31:03.540
So yeah in the mainland.

31:03.740 --> 31:06.790
So if

31:09.340 --> 31:16.200
not ch or if input is equal or not equal to Q

31:18.880 --> 31:20.530
and we'll do all this stuff

31:24.680 --> 31:26.590
otherwise.

31:28.450 --> 31:32.450
Quit schoolteacher k.

31:32.770 --> 31:33.880
So let's run this

31:36.610 --> 31:39.470
rescue and it it's good.

31:40.100 --> 31:40.700
So that's good.

31:40.700 --> 31:44.550
We can try the gaming time we want and keep.

31:44.610 --> 31:51.380
And now let's actually be able to move our character or our little player straight.

31:51.690 --> 31:54.960
So let's actually put a function here

31:57.900 --> 32:00.810
or a function to move our player.

32:00.810 --> 32:05.080
So let's actually down here.

32:05.490 --> 32:09.800
Say a void move.

32:09.840 --> 32:10.490
Player

32:12.990 --> 32:19.370
and I'm actually going to pass it the game and you'll see why in a second.

32:20.670 --> 32:28.890
In Pass player in I'm going to pass in some amount to move it by

32:33.680 --> 32:37.960
Put it down here or draw a game

32:41.140 --> 32:54.550
in and if they press left I want to move him in the negative direction and move where it passing the

32:54.550 --> 32:59.330
game player and move him by some amount.

32:59.360 --> 33:12.900
And again going to make a constant for this player Bentz MT CH and I'm going to make two for now.

33:14.300 --> 33:18.830
So it's going to kind of move too over to either direction.

33:22.240 --> 33:24.550
This is going to be negative for left

33:27.520 --> 33:31.060
and it's going to be positive or right.

33:34.370 --> 33:40.340
And so let's actually implement player

33:43.390 --> 33:50.130
so we want to move the player left and right but we don't ever want to go off the screen.

33:50.170 --> 33:52.670
So that's why I'm passing in the game.

33:52.740 --> 33:55.310
This game has the actual screen boundaries.

33:55.690 --> 34:06.730
So I say if player top position X because we can only move left or right really the player can't move

34:06.730 --> 34:16.450
up or down position X plus the player dot size or the sprite size

34:19.140 --> 34:24.340
dot width because how we're going to have our player.

34:24.480 --> 34:37.670
So if you kind of think of the player terms of his Sprite really is he's going to be like kind of this.

34:37.850 --> 34:39.690
This is going to be his top left.

34:39.940 --> 34:40.570
OK.

34:40.670 --> 34:46.410
So this is kind of is the left most part of this right.

34:46.460 --> 34:51.620
So his position is really kind of right here.

34:51.670 --> 35:06.280
Essentially it's position there so if his position plus the width of the Spryte plus the amount he's

35:06.290 --> 35:15.220
moving is greater than the game's gained much window size dot.

35:15.770 --> 35:17.290
Then he would be off the screen.

35:17.330 --> 35:17.760
Right.

35:20.900 --> 35:33.940
So instead we'll say layered position dot X is the game's state but the wind decides that it's with

35:34.850 --> 35:46.770
minus the player's sprite size.

35:46.810 --> 35:49.390
So this is essentially saying

35:52.750 --> 36:06.310
make sure player doesn't go off the screen to the right.

36:06.660 --> 36:18.550
And this is the rightmost position the player can be care.

36:18.710 --> 36:31.100
And then we'll have to do the same for the other side of the player Deitsch position dot X plus X is

36:31.100 --> 36:33.470
less than zero.

36:33.560 --> 36:35.600
So this means

36:39.430 --> 36:48.390
player is off screen to the left.

36:49.570 --> 36:52.030
Then make sure he's not

36:55.100 --> 36:56.730
set easier.

36:57.200 --> 37:12.160
Otherwise we can just put his position plus equals that the actual x and so let's move.

37:12.240 --> 37:16.560
And that.

37:16.630 --> 37:19.030
So there you go.

37:19.140 --> 37:21.300
So move left and right.

37:21.310 --> 37:28.780
So if I go all the way to the left it's hitting it's hitting this case.

37:29.250 --> 37:35.730
So if I keep I keep trying I'm holding the left arrow key right now and I can't move any more to the

37:35.730 --> 37:37.190
left.

37:37.710 --> 37:44.470
And if I do that for the right it's it's the top case here.

37:44.560 --> 37:45.040
OK.

37:45.040 --> 37:47.800
So his his position.

37:48.070 --> 37:56.060
You can think of it is right here that's what the player's position really is and it's this kind of

37:56.060 --> 37:58.220
top left position right here.

37:58.250 --> 38:00.720
So if he sort of.

38:00.980 --> 38:07.730
So if you take that position plus the width of this right which is five plus how much he would be moving

38:07.730 --> 38:08.830
which is two.

38:09.050 --> 38:10.010
In this case.

38:10.030 --> 38:18.570
Ok if that's greater then the window size with the right the whole size of the window right then makes

38:18.580 --> 38:24.330
sure that he's at the window size minus the sprite height.

38:24.330 --> 38:25.540
So right here.

38:25.830 --> 38:26.550
OK.

38:27.380 --> 38:30.240
So that's kind of what it's saying.

38:30.270 --> 38:35.700
So don't go off the right side and don't go off the left side in the next case.

38:35.790 --> 38:40.590
Otherwise you would ever just just move right.

38:41.010 --> 38:42.940
So there you go.

38:42.960 --> 38:47.690
We have our player moving back and forth in our game.

38:47.800 --> 38:54.720
So in the next lecture I want to make sure that he can shoot scores even.
