WEBVTT

00:01.260 --> 00:03.710
Know we have most of the game working.

00:03.710 --> 00:11.740
I want to start working on a way for the player to input their score after the game is over.

00:11.750 --> 00:19.460
So in a game I'm going to say G-S game over.

00:19.460 --> 00:23.580
And so that will start now in the game over screens.

00:23.810 --> 00:28.240
We don't have to play the game each time we go to that screen directly.

00:28.610 --> 00:36.110
And actually for us to do some things in here that we should probably do is set the wait timer and the

00:37.430 --> 00:40.250
game timer to zero at the start.

00:40.670 --> 00:43.610
And in fact in reset game

00:47.420 --> 00:50.260
it is reset game.

00:50.270 --> 00:52.440
I am also going to say

00:55.130 --> 00:57.560
game.

00:57.900 --> 00:58.270
It's

01:01.090 --> 01:03.250
Game wait timer to be

01:06.240 --> 01:13.900
zero in game time to be Ciro's well.

01:14.510 --> 01:21.520
So this isn't strictly necessary but just gonna put it here anyway.

01:21.950 --> 01:32.470
So to actually make the game over screen and look at where we're drawing it right here we're actually

01:32.470 --> 01:39.190
going to need some new data in our game structure.

01:44.990 --> 01:53.560
So in our game structure we're going to need in the position of the cursor.

01:53.570 --> 02:01.530
So I want to draw you what it looks like first and then kind of explain why we're making the choices

02:01.530 --> 02:02.430
that are making.

02:02.550 --> 02:08.740
OK so here I'm going to see up here.

02:11.140 --> 02:16.620
I'm going to make a new string call the name prompt string

02:20.320 --> 02:28.770
and say Please enter your name.

02:28.900 --> 02:32.390
And again this is in the draw scheme of rescreen.

02:35.520 --> 02:46.320
So we're going to basically get the exposition to put in the middle again.

02:46.360 --> 02:47.050
Neme

02:49.480 --> 02:57.530
exposition is game size.

02:58.510 --> 03:03.700
Two minus the name.

03:05.000 --> 03:11.200
String top like to that.

03:13.970 --> 03:17.870
And essentially we're going to

03:20.370 --> 03:23.710
draw the string in

03:26.550 --> 03:28.300
in each

03:30.610 --> 03:40.630
position say give it some space between Tweenies.

03:41.850 --> 03:44.490
That's OK.

03:44.520 --> 03:51.520
And in fact we might actually make this higher up so he'd be over three for the wife has sort of a 2

03:52.880 --> 03:58.050
and we're going to go through a loop

04:01.770 --> 04:10.410
and remember the can only have three letters for your name.

04:10.410 --> 04:17.210
So for in the game over screen the player enters his her three letter name.

04:17.240 --> 04:19.890
They only have three letters in.

04:19.910 --> 04:20.420
Sure.

04:20.460 --> 04:21.570
We have

04:25.470 --> 04:39.070
the constant for that don't do so make one player or max number of characters

04:41.520 --> 04:53.440
in name three it's constant I'm going to use are there.

04:53.560 --> 04:54.860
That's a plus.

04:56.380 --> 04:57.920
OK.

04:58.530 --> 05:05.110
And we're going to say if I could too.

05:05.250 --> 05:10.340
Well actually I'm just going to.

05:10.700 --> 05:12.260
Yeah.

05:12.330 --> 05:24.120
Just for this first one it's first time through the loop say at Tron a underline use attributes here

05:24.840 --> 05:38.300
for the text to draw in and say draw or her and it's going to take the

05:41.770 --> 05:43.050
game.

05:43.730 --> 05:45.070
Two sides

05:47.710 --> 05:51.410
to wit two minus.

05:52.860 --> 05:55.080
Max number of characters.

05:57.660 --> 06:12.390
Two plus I entering into the y position and then I just want to get some space in five say and I'm going

06:12.400 --> 06:14.740
to give it some character

06:17.910 --> 06:29.360
and then I'm going to say if I is 0 turn off underline

06:33.340 --> 06:34.790
OK.

06:34.970 --> 06:36.560
So I run this

06:41.030 --> 06:47.420
so it says game over press spacebar to continue and says Please enter your name.

06:47.420 --> 06:53.600
You can see that we'll be able to choose the letters of our name essentially.

06:54.440 --> 07:02.240
So if I press down it should this first one that's highlighted underlined in this case.

07:02.240 --> 07:09.860
If I press down it'll go to B if I press to the right it'll go to the next to the next character and

07:10.030 --> 07:12.560
press to the left to go back center.

07:12.560 --> 07:12.890
Right.

07:12.890 --> 07:15.860
So you've seen this kind of thing before.

07:15.860 --> 07:19.870
Maybe an arcade games where you can kind of choose your name.

07:20.010 --> 07:20.730
OK.

07:21.020 --> 07:24.960
So that's kind of the idea of what we're going to be doing.

07:25.310 --> 07:31.360
So that's this is that.

07:31.530 --> 07:37.110
So a lot of the game overstuff drawing at least is done but there's going to be a couple more things

07:37.250 --> 07:38.270
to do.

07:38.740 --> 07:44.670
And in our game structure

07:48.430 --> 07:51.970
we're going to need some more data.

07:52.000 --> 07:56.650
So when you say game over.

07:56.650 --> 08:10.490
Horizontal position of the cursor case this will tell us where horizontal cursor is.

08:10.720 --> 08:11.520
OK.

08:12.030 --> 08:22.050
And we're going to need a buffer for character array for the player name in which you use the next number

08:22.050 --> 08:25.530
of characters plus one for the null character.

08:25.800 --> 08:27.710
And we're also going to need each

08:31.930 --> 08:33.590
the vertical

08:36.360 --> 08:43.240
position for each Kurs or for that cursor for each hers.

08:43.270 --> 08:45.480
Sorry.

08:45.560 --> 08:56.490
So we're going to kind of store where we were in the vertical case for each each letter.

08:56.960 --> 09:08.680
So that answer I really need those three those three pieces of data Okay.

09:08.680 --> 09:16.120
So in our leaders dot BP

09:18.780 --> 09:22.860
basically we're going to do is we're only going to highlight the one that we're at.

09:22.900 --> 09:33.400
So it's a if it's equal to the game cursor or game over each position so or sorry then we'll underline

09:33.400 --> 09:33.550
it.

09:33.550 --> 09:42.780
So that's that's where we are horizontally in the name and.

09:42.910 --> 09:48.540
And so now we're done with this drawing.

09:48.680 --> 09:55.870
So draw game over screen is done but now we need to be able to move the cursor and all that stuff.

09:55.870 --> 09:56.460
So

09:59.370 --> 10:06.070
in that game we have

10:11.560 --> 10:18.270
here to set the cursor all the cursor stuff here.

10:18.300 --> 10:23.660
So game over cursor position in action.

10:23.690 --> 10:28.850
Actually there's one other thing we need to do for draw you over in a second.

10:29.630 --> 10:33.740
So we're going to initialize the horizontal cursor to be the this is the first letter

10:37.490 --> 10:44.010
right very left the most letter and are going to go through all of them

10:47.890 --> 10:49.060
in.

10:49.090 --> 10:56.890
Are all the letters in the name and are going to say Play player name are going to start at all at a.

10:56.940 --> 11:05.630
So if you ever again if you've ever played a arcade game they always start at a few name or maybe four

11:05.630 --> 11:14.620
days of them for characters so and for this I'm going to use them all zero.

11:14.840 --> 11:15.440
OK.

11:16.940 --> 11:26.470
So basically be at be a.

11:26.540 --> 11:28.640
So that's it for that.

11:28.660 --> 11:33.310
And back in the game over screen missed something

11:39.660 --> 11:45.530
here this should be the game.

11:53.840 --> 11:54.560
This

12:07.150 --> 12:13.230
K so the player's name at that at that spot.

12:16.010 --> 12:21.060
So that's it for game over now.

12:21.260 --> 12:28.190
So if you're in this see happens so nothing nothing's really changed yet.

12:28.190 --> 12:28.890
Right.

12:29.440 --> 12:37.610
So now we need to be able to move the cursor left and right and up and down for each letter.

12:37.730 --> 12:38.100
OK.

12:38.150 --> 12:44.950
So let's do that.

12:45.020 --> 12:47.990
So we'll do that in hand in put

12:51.270 --> 12:51.960
and.

12:52.130 --> 12:56.450
And let's start with the left and right.

12:57.600 --> 13:05.730
So else if gamed current state which to over

13:08.910 --> 13:13.800
something it's really right.

13:18.010 --> 13:18.280
Right.

13:18.410 --> 13:24.190
He does something.

13:24.280 --> 13:27.160
So here set

13:30.070 --> 13:47.490
game dot horizontal cursor equal to named each until the cursor plus one percent the number HRmax number

13:49.690 --> 13:53.880
characters in the name

13:56.720 --> 13:57.820
like that.

13:58.030 --> 13:58.540
OK.

13:59.590 --> 14:13.260
And for the laugh it's one to say game over simple cursor to name Dutch

14:16.000 --> 14:18.880
over a horizontal position cursor minus one.

14:18.900 --> 14:20.370
And then check to see

14:23.180 --> 14:25.680
if the game Dots.

14:28.170 --> 14:30.890
Horizontal cursor is less than zero.

14:30.900 --> 14:36.230
Then we'll go to the rightmost one.

14:38.940 --> 14:42.890
This is an X mirror.

14:44.840 --> 14:46.170
Characters

14:48.430 --> 14:50.430
in name.

14:50.430 --> 14:51.730
Minus one right.

14:52.700 --> 14:55.760
So it goes from here

14:58.980 --> 15:04.680
doing the modulus because it has to be from 0 to 2 from 0 to Max.

15:04.680 --> 15:07.420
Number of characters in name minus one.

15:07.500 --> 15:08.920
So this is three.

15:08.920 --> 15:20.130
So if I say where I was plus 1 and then modulus this sure I mean I'm still in the bounds of the 0 2

15:20.220 --> 15:21.130
range.

15:21.150 --> 15:22.870
So that's what this is doing.

15:22.920 --> 15:25.740
And this is saying if I go to the right one

15:29.380 --> 15:32.830
or sorry this should be this is the opposite.

15:33.130 --> 15:34.530
This actually is left.

15:34.560 --> 15:36.920
Sorry totally.

15:36.950 --> 15:38.030
That's backwards.

15:38.030 --> 15:39.280
So you like this

15:42.190 --> 15:42.810
down here

15:52.560 --> 15:53.580
button using

16:06.010 --> 16:06.750
like that.

16:06.750 --> 16:14.840
So if I go to the left which is minus 1 right then it is negative a negative value.

16:14.850 --> 16:18.450
I should go to the fair right most of the cursors.

16:18.600 --> 16:19.280
OK.

16:19.500 --> 16:23.310
So if I run this yields kind of see you mean.

16:23.530 --> 16:29.350
So now I should be able to move the cursor left and right so I'm only pressing right.

16:29.610 --> 16:34.700
In fact press it again it goes left and I go to the left it goes to the end.

16:34.810 --> 16:41.790
So this is just choosing which letter I'm changing.

16:43.030 --> 16:44.320
That's all that meant.

16:47.560 --> 16:53.520
So now I want to have new cases in here.

16:56.380 --> 17:04.050
Or a k up.

17:04.260 --> 17:13.730
And we're also going to have case for doubt.

17:13.780 --> 17:22.990
So for the upper case to say if the game current state is game over screen

17:27.740 --> 17:28.700
then

17:31.160 --> 17:36.290
you are.

17:36.340 --> 17:48.580
So if it's the game over screen then in say game dot over vertical position of the horizontal position

17:50.070 --> 17:57.630
or equal to game over vertical position

18:01.220 --> 18:02.280
again.

18:06.160 --> 18:11.920
On proposition minus one and then if

18:14.700 --> 18:21.980
game dot over Go position in

18:25.210 --> 18:27.550
position is less than zero.

18:29.900 --> 18:32.110
We will say game dot.

18:32.160 --> 18:40.400
Game over vertical position and gained each over result.

18:41.690 --> 18:48.500
Equal to when the 6 minus 1.

18:48.540 --> 18:56.490
So if you are not following what I just did centrally what we're going to be doing is in this again

18:57.720 --> 19:01.550
if I press up right.

19:02.090 --> 19:12.310
And if so basically 0 through 25 is going to be the alphabet right so 0 is going to be a and 25 is going

19:12.680 --> 19:14.000
it.

19:14.390 --> 19:24.180
So the is so 0 represents a 25 for Zed.

19:24.260 --> 19:33.020
So if I my current value in the vertical position cursor right which is

19:35.700 --> 19:40.650
an integer but it's not really sure it's really a character.

19:40.890 --> 19:48.410
If if I press up in I met a real saying then go to Zed.

19:48.510 --> 19:50.430
So that's that's really what it means.

19:50.820 --> 19:58.010
And we're going to say game dot where name Dutch

20:01.500 --> 20:07.630
it's all said a plus.

20:11.120 --> 20:15.600
Erkel position is on session.

20:15.690 --> 20:21.730
So the horizontal position tells us where in the vertical position cursor that we are.

20:23.140 --> 20:32.830
So here I'm saying let a or the players name be a plus.

20:32.830 --> 20:38.470
Wherever we are in the vertical position cursor in the vertical vertical position cursors values can

20:38.470 --> 20:41.730
only be from 0 to 25.

20:41.950 --> 20:47.050
And we're using 26 here because that's how many letters of the alphabet there are.

20:47.530 --> 20:50.940
So.

20:51.530 --> 21:00.290
So basically what we're doing is here the game vertical position cursor is set wherever we are in a

21:00.290 --> 21:09.100
horizontal cursor and then we just minus one from that vertical position cursor and if we were less

21:09.100 --> 21:10.060
than zero.

21:10.150 --> 21:15.020
So this will just change to be safer and B This will not be right.

21:15.020 --> 21:17.560
Or C notes B.

21:17.920 --> 21:22.890
So if we're at it's a here be at it.

21:23.000 --> 21:33.110
So wrap around and then update the name and we'll have the same similar thing to the down

21:35.590 --> 21:36.310
gamed.

21:36.390 --> 21:38.280
It hurts th

21:42.050 --> 21:49.630
over then basically just do the exact same thing that

21:52.630 --> 21:54.730
position Mr.

22:10.730 --> 22:11.700
Well one

22:14.110 --> 22:28.300
sent the number in will make group the concert this so add add one to the to the vertical position cursor

22:28.960 --> 22:32.780
at the horizontal position cursor right.

22:32.830 --> 22:40.210
So if it was a now it's B and then make sure that say you are at Zed and we added one.

22:40.260 --> 22:42.300
This will go back to zero.

22:42.650 --> 22:44.200
Roback to zero.

22:44.800 --> 22:47.070
That's what this is saying.

22:47.320 --> 22:52.030
And then we just need to update our name just like

22:56.370 --> 23:16.140
this.

23:16.740 --> 23:18.980
So let's make constant

23:22.920 --> 23:24.370
marks.

23:26.140 --> 23:32.140
It's.

23:32.700 --> 23:43.310
Six.

23:45.960 --> 23:47.930
Six should have that

24:21.500 --> 24:26.350
work.

24:26.840 --> 24:31.950
So if I press down to be for press down it's C D.

24:32.210 --> 24:40.460
If I go over one and I change this right see how it's like rapping.

24:40.650 --> 24:45.260
Still seems kinda messed up actually Zed.

24:45.480 --> 24:46.710
I pressed down.

24:46.800 --> 24:48.080
It's wrong.

24:49.940 --> 24:50.740
It's bad

24:56.470 --> 25:01.260
so it's actually not working exactly correct.

25:07.710 --> 25:11.070
So it's this

25:17.140 --> 25:17.550
it

25:21.420 --> 25:23.860
was it gay.

25:23.970 --> 25:31.940
So this.

25:32.020 --> 25:42.170
So I what I did was I put these in brackets should be plus one like this and then and then the percent

25:43.000 --> 25:45.890
or the modulus the alphabet characters.

25:46.330 --> 25:47.940
So that was a typo.

25:50.010 --> 25:54.630
So now we have all of that working.

25:54.680 --> 26:09.040
So in the next lecture I want to actually start saving the player name when you press enter into like

26:09.060 --> 26:11.670
an actual score table.

26:12.020 --> 26:13.090
So I'll see you then.
