WEBVTT

00:00.040 --> 00:07.040
As you can see, I have opened it up an empty project, so we will move over to our hierarchy.

00:07.200 --> 00:12.000
I just want to make the background a little bit dark gray, something like that.

00:12.280 --> 00:15.920
Uh, so I'm gonna select my main camera in the hierarchy.

00:16.080 --> 00:20.840
Let's go over to Inspector Camera component, and then let's click on this background.

00:20.840 --> 00:23.640
And we're gonna choose this color, something like that.

00:23.960 --> 00:26.240
And let's create our player.

00:26.600 --> 00:29.840
Uh, but before we create let's create the ground first.

00:29.840 --> 00:31.720
So we will head over to hierarchy.

00:31.720 --> 00:33.960
Let's right click or hit this plus icon.

00:33.960 --> 00:36.080
Then go to 2D Object Sprites.

00:36.080 --> 00:37.800
And we're gonna choose this square.

00:38.200 --> 00:41.000
And let's select the move tool from this interview.

00:41.000 --> 00:43.600
And let's move it somewhere around here.

00:44.040 --> 00:47.320
And let's select the rake tool from here in this in view.

00:47.480 --> 00:49.160
And we're gonna hold down alt.

00:49.160 --> 00:52.560
So it's gonna resize from center as you can see.

00:52.800 --> 00:55.480
So this is our will be ground.

00:55.520 --> 00:58.960
So let's rename this to square to ground.

00:58.960 --> 00:59.000
round.

00:59.000 --> 01:04.040
So let's call it round and let's add some components to this round.

01:04.120 --> 01:07.760
So first thing I'm gonna add a sum.

01:07.960 --> 01:12.360
Firstly I'm going to add a box collider 2D for collision detection.

01:12.360 --> 01:17.160
So let's click on this add component and let's add a box Collider 2D.

01:17.520 --> 01:19.800
And now let's create our player.

01:20.000 --> 01:22.560
And to do so let's head over to hierarchy.

01:22.760 --> 01:25.560
And we're going to right click or hit this plus icon.

01:25.560 --> 01:29.480
Let's right click let's go to 2D objects sprites and then square.

01:29.720 --> 01:33.280
And I'm going to call this square to something like player.

01:33.760 --> 01:37.440
And and we're going to reset the transform.

01:37.440 --> 01:39.920
To do so let's head over to Inspector Transform.

01:39.920 --> 01:42.400
Let's right click there and then reset.

01:42.720 --> 01:47.000
And we will add some components to this player as well.

01:47.040 --> 01:50.720
First thing we will add a rigid body 2D for gravity.

01:50.720 --> 01:52.800
So let's click on this add component.

01:52.800 --> 01:55.160
Let's add up rigid body 2D.

01:55.320 --> 02:00.400
And let's scale up the gravity is something around three and collision detection to.

02:00.440 --> 02:03.160
We're going to choose continuous and interpolate.

02:03.160 --> 02:07.040
We will choose interpolate or you can just skip this interpolate.

02:07.040 --> 02:08.720
You can just leave it to none.

02:09.080 --> 02:10.960
And if you choose interpolate.

02:10.960 --> 02:13.440
So it's going to make a little bit smooth.

02:13.440 --> 02:14.320
So that's why.

02:14.560 --> 02:19.920
And we want to rotate as z rotation like this to stop this.

02:19.920 --> 02:22.120
So firstly I'm going to set back to zero.

02:22.360 --> 02:24.200
We will move over to constraint.

02:24.200 --> 02:27.760
And then we're going to freeze the rotation about z axis.

02:27.760 --> 02:29.080
And now it's done.

02:29.080 --> 02:36.840
And let's add one more component which will be a box collider 2D for to for collision detection.

02:36.840 --> 02:41.640
So let's click on this add component and let's add up one more time box Collider 2D.

02:41.800 --> 02:47.440
So if we go ahead and then click on this play button in the top you will see this player game object

02:47.440 --> 02:54.680
just gonna fall down as soon as the game just gonna start because we added Rigidbody 2D and later on

02:54.680 --> 02:57.950
we're gonna to replace this square with something player.

02:57.950 --> 03:03.710
So we need to import all of the assets that we need, and we can take a look on it later.

03:03.710 --> 03:10.310
So as you can see, as soon as our game started, this player game object just fall down due to our

03:10.350 --> 03:12.030
gravity to this ground.

03:12.030 --> 03:17.350
So let's get out of play mode and let's make the movement to do so, we will create a script.

03:17.350 --> 03:20.510
So we will head over to our project tab assets.

03:20.510 --> 03:26.150
And then uh, and then this assets folder, let's right click there create folder.

03:26.150 --> 03:30.310
And you can call that folder to something like scripts.

03:30.310 --> 03:31.710
So let's call it script.

03:31.910 --> 03:38.830
And I already created a player script as you can see to create that just move over to that script folder.

03:38.870 --> 03:44.510
Then right click create then scripting, and then click on this Monobehaviour script.

03:44.550 --> 03:49.310
And you can name that script to something like player movement or simply player.

03:49.310 --> 03:55.630
So I have the script, I'm gonna take this and drag it over to that scripts folder to keep the project

03:55.670 --> 03:56.830
a little bit clean.

03:57.070 --> 04:03.150
So we just create folders to keep our project clean, and it's going to take a few moments to compile.

04:03.390 --> 04:07.750
And what we will do now we're going to select our player game object in the hierarchy.

04:07.950 --> 04:09.670
And let's select that player script.

04:09.670 --> 04:13.110
Drag it over to this Add component section and the inspector.

04:13.110 --> 04:15.950
Or you can simply click on this add component.

04:15.950 --> 04:21.230
And you can find the script by typing the name of the script, which is in our case player.

04:21.630 --> 04:24.830
So so we're going to click on this add component.

04:25.310 --> 04:29.150
So we already drag it as you can notice in the inspector.

04:29.150 --> 04:31.870
Or you can simply click on this add component.

04:31.870 --> 04:35.310
And you can find the component by typing the name of the component.

04:35.310 --> 04:36.990
So in our case player.

04:36.990 --> 04:39.870
And then click there in order to attach it.

04:39.910 --> 04:42.470
We're not going to do it since we already attached.

04:42.470 --> 04:46.030
So we will open up our player script by double clicking on it.

04:46.430 --> 04:51.270
So as you can see by default we have the start function and this update function.

04:51.310 --> 04:57.070
So we will go to the top of our class and we're going to make a private float movement.

04:57.270 --> 05:01.510
Uh, basically what we will do, we will move over to this update function.

05:01.510 --> 05:05.190
So we do know that this update function runs every single frame.

05:05.190 --> 05:08.190
So every single frame we're going to check for some input.

05:08.190 --> 05:15.870
So to move our player left and right we're going to use this input dot get access function.

05:16.070 --> 05:18.870
So this input dot get axis.

05:18.870 --> 05:20.750
And then make this first bracket.

05:20.750 --> 05:27.070
And inside this first bracket we need to put the axis in which axis we want to move.

05:27.110 --> 05:30.230
Since we want to move our player horizontally.

05:30.430 --> 05:31.670
Uh like this.

05:31.670 --> 05:36.390
So in quotation we need to type horizontal and make sure you spelling it correct.

05:36.390 --> 05:37.550
So put quotation.

05:37.550 --> 05:45.030
And inside this quotation you need to put this horizontal horizontal and then close that output semicolon.

05:45.030 --> 05:48.030
So this input dot get axis horizontal function.

05:48.030 --> 05:50.310
It's going to check some input.

05:50.310 --> 05:57.270
So let's suppose you press down press down D key on your keyboard, or you hold down D key on your keyboard.

05:57.310 --> 06:00.590
Then this function over here is gonna give us one.

06:00.590 --> 06:08.870
And if you hold down a key instead of D key then this input z axis horizontal is just gonna give us

06:08.870 --> 06:09.790
minus one.

06:10.110 --> 06:14.510
And if we don't hold down both of those keys it will be zero.

06:14.750 --> 06:20.070
So this input or gate is just going to check for with some input which will be a and D.

06:20.230 --> 06:23.830
If we hold down a key then it's gonna give us minus one.

06:23.830 --> 06:27.750
And if we hold down D key it's gonna give plus 1 or 1.

06:27.750 --> 06:34.230
And if we just lift off our finger from both of those kids, then it's gonna give us a zero value.

06:34.230 --> 06:40.470
So what we will do, we will store that value into a container or into a float variable.

06:40.470 --> 06:48.740
Since this is gonna return one or plus 1 or 0, which will be a float number or integer, but it would

06:48.740 --> 06:52.020
be perfect if we just store into a float number.

06:52.180 --> 06:53.140
So what we will do?

06:53.180 --> 06:58.060
We will go to the top of our class and we're gonna make a public variable.

06:58.460 --> 07:02.180
But it doesn't need to be public so we can make it private instead.

07:02.180 --> 07:07.900
So if we make it private, we do know that we're not gonna be able to inspect underneath or basically

07:07.900 --> 07:12.100
we're not gonna able to see underneath our player skip in inspector.

07:12.460 --> 07:14.300
So but we still want to see.

07:14.300 --> 07:15.780
So we're gonna tweak that.

07:15.780 --> 07:19.580
So let's make a private and that will be float.

07:19.580 --> 07:21.740
And we can call this one movement.

07:21.740 --> 07:23.740
So let's call this one movement.

07:23.740 --> 07:25.980
And let's close that up with semicolon.

07:25.980 --> 07:32.380
And now what we're gonna do whatever we get we're gonna store that value into this movement parameter.

07:32.380 --> 07:37.420
Or you can say a variable or variable or you can see this float movement.

07:37.420 --> 07:39.420
It's just gonna work as a container.

07:39.420 --> 07:42.380
So we're storing the value into this movement.

07:42.380 --> 07:48.980
So let's suppose we hold down D key then this input dot get access horizontal function is going to give

07:49.020 --> 07:50.980
us a plus 1 or 1.

07:50.980 --> 07:54.740
So this movement right over here is going to be plus 1 or 1.

07:54.740 --> 08:02.660
Because as you can see it's simply we just simply setting it movement equal to input dot get axis horizontal.

08:02.660 --> 08:08.620
And let's assume if we hold down a key then this input dot get axis horizontal function.

08:08.620 --> 08:10.660
It's gonna give us minus one.

08:10.660 --> 08:14.700
So that's why this movement right over here it's going to be minus one.

08:14.700 --> 08:21.500
And if we lift off both of fingers from both of those keys then this input dot get access horizontal

08:21.540 --> 08:22.540
is gonna be zero.

08:22.540 --> 08:25.980
So that's why this movement right over here will be zero.

08:25.980 --> 08:29.740
So let's now press Ctrl S in order to save our skip.

08:29.740 --> 08:31.700
And now let's move over to unity.

08:32.020 --> 08:38.300
So we will see that movement just gonna change according to which cube we are holding down.

08:38.300 --> 08:42.340
If we hold down D key, then it's going to give us plus 1 or 1.

08:42.340 --> 08:47.100
And if we hold down a key, it's going to give us minus one, minus one.

08:47.540 --> 08:53.180
But the problem is that, as you can see, as soon as our player skip gets compiled, we are not able

08:53.180 --> 08:56.940
to notice our movement parameter underneath our player skip.

08:56.980 --> 08:57.460
Why?

08:57.620 --> 09:00.620
Because we made this field private, as you can see.

09:00.780 --> 09:05.460
But let's suppose we still want to see that field underneath our player skip.

09:05.500 --> 09:06.940
So how we can do that.

09:06.980 --> 09:10.220
In order to do it just move over to Inspector.

09:10.220 --> 09:12.140
In the top right you can see three dots.

09:12.140 --> 09:14.900
So just click there and then click on this debug.

09:15.060 --> 09:20.580
And as soon as we have chosen debug we can see underneath our player skip the movement.

09:20.580 --> 09:23.180
And by default it's set to zero.

09:23.340 --> 09:29.580
So now if we click on this play button in the top and try to hold down a and key, you will see this

09:29.580 --> 09:33.740
movement parameter just gonna change with the key we holding down.

09:33.780 --> 09:37.260
If we hold down D key then this movement will be one.

09:37.260 --> 09:40.620
And if we hold down a key this movement will be minus one.

09:40.700 --> 09:46.580
So now if I hold down D key, as you can see, as soon as I am holding down it became one.

09:46.580 --> 09:49.420
And if I lift up my finger it became zero.

09:49.420 --> 09:53.460
And now if I hold down a key, it became minus one.

09:53.460 --> 09:56.540
And if I lift up my finger it became zero.

09:56.540 --> 10:02.380
So I hope you get the idea that how how we can use that function in order to move it.

10:02.380 --> 10:04.100
So I'm going to get out of play mode.

10:04.260 --> 10:10.940
And now what we have to do, we need to move our player instead of just making this minus one or plus

10:10.980 --> 10:11.500
one.

10:11.500 --> 10:17.300
So if we just are, let's suppose you just go or want to go back to normal mode.

10:17.300 --> 10:22.340
So just move over to Inspector one more time and then top right you can see three dots.

10:22.340 --> 10:25.100
So just click there and then click on this normal.

10:25.100 --> 10:27.500
So it's you're going to go back to normal.

10:27.500 --> 10:33.020
So what we're going to do we're going to use that movement parameter in order to move our player.

10:33.020 --> 10:39.140
So if we select our player in the hierarchy and then move over to Inspector and then transform component

10:39.140 --> 10:44.620
and play around with X position, we can see that this player is moving left and right.

10:44.620 --> 10:51.180
So we need to replace this x position with our movement parameter, which can be minus one plus 1 or

10:51.180 --> 10:54.180
0 depending upon which key we are holding down.

10:54.180 --> 10:59.220
So if I hold down d key so then if we replace this x with our movement.

10:59.220 --> 11:01.020
So movement is just going to be one.

11:01.020 --> 11:07.980
And as soon as we put in one this square or this player just going to the right direction, and if we

11:08.020 --> 11:13.100
hold down a, a a key, then we do know that that movement is going to be minus one.

11:13.100 --> 11:18.180
So if we put minus one we can see this player is moving to the left direction.

11:18.180 --> 11:21.340
So we're gonna use that parameter in order to move it.

11:21.340 --> 11:23.660
So I'm going to set back to zero.

11:23.660 --> 11:27.580
So what we need we need to move over to this transform then position.

11:27.580 --> 11:30.220
And top of that we're going to add a Vector3.

11:30.260 --> 11:34.260
Since this position has x axis, y axis and the z axis.

11:34.260 --> 11:39.490
And that Vector3 also going to have x axis, y axis and z axis.

11:39.490 --> 11:43.050
So now let's open up our player script by double clicking on it.

11:43.050 --> 11:45.810
And for that we're going to use fixed update.

11:45.810 --> 11:49.450
So we will use this fixed update instead of update.

11:49.450 --> 11:51.050
So this function.

11:51.050 --> 11:54.890
So this fix update function get call with fixed frame rate.

11:55.290 --> 12:00.730
Basically let's suppose in one second it's run 60 frames as 60 frames.

12:00.730 --> 12:06.130
Then in the next second is still going to run in one second 60 frames.

12:06.130 --> 12:08.210
So the frame rate will be constant.

12:08.210 --> 12:15.730
It's not going to be something like 55, sometimes 60, sometimes 62, but the frame rate will be constant

12:15.730 --> 12:23.130
if it's uh, if it's run in one second 60 frame 60 frames means in second, second, it will still run

12:23.130 --> 12:24.970
in 60 frames.

12:24.970 --> 12:26.450
So basically that is the thing.

12:26.450 --> 12:29.370
So that's why we're using this fixed update.

12:29.370 --> 12:36.290
And now what we're gonna do, we're gonna go over to our transform dot position and transform dot Transform.position

12:36.290 --> 12:39.410
over here basically means current position of this player.

12:39.450 --> 12:44.610
Basically we just going over to this transform and then position and top of that we're going to add

12:44.610 --> 12:45.610
our movement.

12:45.610 --> 12:54.490
So we're going to use this plus equal new Vector3 Vector3 which is going to have x axis y axis z axis.

12:54.490 --> 13:00.890
And now we're going to close that up with semicolon because this transform.position have x axis y axis

13:00.890 --> 13:03.210
and the z axis as you can see.

13:03.210 --> 13:11.130
So that's why we just using this plus equal a new Vector3 Vector3 which also has x axis, y axis and

13:11.130 --> 13:12.530
the z axis.

13:12.530 --> 13:19.930
So we don't want to move at at all in the y axis basically up something like this or in the z axis.

13:19.930 --> 13:21.690
So that's why sorry.

13:22.770 --> 13:28.370
That's why in the uh in the y axis we're going to put zero in the z axis.

13:28.410 --> 13:29.970
We're going to put zero f.

13:30.170 --> 13:33.170
But in the x we do one do one move.

13:33.170 --> 13:40.010
So that's why we're gonna pass this movement, which can be minus one plus 1 or 0, depending upon which

13:40.050 --> 13:41.490
key we folding down.

13:41.730 --> 13:43.650
So let's suppose we hold down D key.

13:43.850 --> 13:50.410
Then this movement right over here is going to be one means in the x we replacing our x.

13:50.410 --> 13:53.530
Basically this x with our movement which is one.

13:53.530 --> 13:55.690
So it's going to go to the right direction.

13:55.690 --> 14:03.010
And if the movement is minus one means we holding down a key, then we replacing this x with our movement

14:03.010 --> 14:04.490
which will be minus one.

14:04.490 --> 14:07.770
So this player will start moving to the left direction.

14:07.770 --> 14:09.410
So I hope you get the idea.

14:09.410 --> 14:14.730
And now what we're gonna do, we're gonna multiply this whole thing with our fixed delta time to make

14:14.730 --> 14:16.250
frame rate constant.

14:16.250 --> 14:21.130
So we're going to multiply with time dot time dot fixed delta time.

14:21.130 --> 14:27.170
Why we multiplying with this time dot fixed delta delta time instead of time delta time.

14:27.170 --> 14:30.970
Because we're doing inside this fixed update as you can notice.

14:30.970 --> 14:35.650
So that's why we're using this fixed delta time, which is simply multiplying with time.

14:35.690 --> 14:37.130
Dot fixed delta time.

14:37.130 --> 14:41.170
And now we're going to press down control S in order to save our script.

14:41.170 --> 14:43.010
And let's move over to unity.

14:43.170 --> 14:49.530
So we will start moving to the left or right direction depending upon which key we holding down.

14:49.530 --> 14:51.730
So we're going to take a look on that.

14:51.730 --> 14:55.890
And later on we're going to replace this square with our player.

14:56.050 --> 14:57.850
Uh don't worry about that.

14:57.850 --> 15:04.650
So now if I go ahead and then click on this play button in the top in order to start our game, we should

15:04.650 --> 15:06.050
be able to notice it.

15:06.930 --> 15:08.530
So just wait a moment.

15:11.130 --> 15:14.450
So now let's start our game.

15:14.450 --> 15:20.850
And if I try to hold down D key, as you can see, as soon as we holding down D key it's started moving

15:20.890 --> 15:22.210
to the right direction.

15:22.410 --> 15:29.770
And if I hold down a key we can notice that this player or this square just started moving to the left

15:29.770 --> 15:30.570
lab direction.

15:30.570 --> 15:37.050
But if I lift up my both of my finger from both of those key, we can see player just standing at one

15:37.050 --> 15:37.490
point.

15:37.490 --> 15:44.450
Because if we just, uh, don't hold down A or D key, that input dot get access function is just gonna

15:44.450 --> 15:45.250
give us zero.

15:45.290 --> 15:50.730
Basically means we're not gonna move at all, and we're just gonna stand at a point.

15:50.930 --> 15:54.290
Uh, so I hope you get the idea that how you can do it.

15:54.290 --> 15:57.930
But it would be nice if we move a little bit faster.

15:57.930 --> 16:04.170
So we will get out of play mode and we will open up our player skip, and we will multiply this whole

16:04.170 --> 16:06.810
thing, uh, which becomes minus one.

16:07.170 --> 16:10.370
So what we're going to do, we're going to multiply with some unit.

16:10.650 --> 16:12.530
Uh, so let's make a variable.

16:12.690 --> 16:15.130
So we will go to top of our class.

16:15.130 --> 16:17.370
And we're going to make a variable for it.

16:17.570 --> 16:20.210
And we're going to make this variable private.

16:20.210 --> 16:21.770
And that will be float.

16:21.770 --> 16:24.050
And we can call this one move speed.

16:24.050 --> 16:25.810
So let's call it move speed.

16:25.930 --> 16:29.720
And by default I'm going to set equal to something like five F.

16:29.760 --> 16:31.840
And let's close that off with semicolon.

16:32.080 --> 16:34.600
But as you can notice, we set it private.

16:34.600 --> 16:38.040
So we're not going to able to notice underneath our player skip.

16:38.120 --> 16:42.000
But we still want to see that underneath our player skip.

16:42.000 --> 16:44.240
So we can adjust right over here.

16:44.240 --> 16:49.400
And we don't need to come to the script and change that value over again and again.

16:49.400 --> 16:50.600
But we made it private.

16:50.600 --> 16:52.920
So that's why we're not going to able to notice.

16:53.040 --> 16:56.680
But let's suppose we still want to notice that.

16:56.720 --> 17:01.800
Or we just want to inspect, uh, underneath our inspector tab.

17:01.800 --> 17:04.720
So we need to mark this as a field.

17:04.760 --> 17:08.400
Basically you need to make this square square brackets.

17:08.400 --> 17:10.680
And you need to type this serialized field.

17:10.800 --> 17:17.480
And now even through this, uh, this, uh, parameter is a private, we're still gonna able to see

17:17.520 --> 17:19.160
underneath our player skip.

17:19.160 --> 17:25.880
But the problem is that we're not gonna able to access this parameter from another class or from from

17:25.880 --> 17:27.320
another sea scape.

17:27.320 --> 17:28.920
Basically that is the thing.

17:28.920 --> 17:32.840
And making this way keeps our coat a lot more clean, so that's why.

17:32.880 --> 17:35.040
So we just marked as realized fill.

17:35.040 --> 17:41.160
So even though it's private we still just gonna able to notice underneath our player skip right over

17:41.160 --> 17:42.720
here in the inspector.

17:42.920 --> 17:49.840
And now what we're gonna do, we're gonna multiply this whole thing with our, uh, with our this move

17:49.840 --> 17:50.280
speed.

17:50.280 --> 17:53.160
So let's multiply with our move speed.

17:53.200 --> 17:53.560
Sorry.

17:53.600 --> 17:54.840
Not movement.

17:54.880 --> 17:57.720
We're gonna multiply with move speed and move speed.

17:57.720 --> 18:00.640
By default, we set it to five, as you can see.

18:00.640 --> 18:04.240
So this movement is gonna be minus one, 1 or 0.

18:04.240 --> 18:07.760
So this will be let's suppose we hold down d key.

18:07.960 --> 18:11.360
So this movement right over here it's gonna be minus one.

18:11.360 --> 18:13.360
So this move speed is five.

18:13.360 --> 18:16.000
So minus one into five will be minus.

18:16.080 --> 18:16.400
Uh.

18:16.680 --> 18:17.160
Sorry.

18:17.400 --> 18:18.440
Uh, sorry.

18:18.480 --> 18:22.680
If we hold down d key, I really apologize if we hold down d key.

18:22.720 --> 18:24.880
So this movement is just going to be fun.

18:25.120 --> 18:27.600
And this speed is five.

18:27.600 --> 18:35.120
So five into one will be five means we will start moving to the right direction with a five unit of

18:35.120 --> 18:35.720
speed.

18:35.720 --> 18:37.520
So basically that is the thing.

18:37.520 --> 18:39.400
And let's suppose we hold down a key.

18:39.440 --> 18:42.960
Then this movement right over here it's going to be minus one.

18:42.960 --> 18:45.080
So this over here is minus one.

18:45.080 --> 18:46.720
And this move speed is five.

18:46.720 --> 18:53.880
So five into minus one will be minus five means we will we will start moving to the left direction with

18:53.880 --> 18:55.360
minus five unit.

18:55.360 --> 18:57.120
So I hope you get the idea.

18:57.120 --> 19:00.120
But we do know that we just marked as cereals fill.

19:00.120 --> 19:06.240
So we don't need to calm this, come to this script and change this value over again and again since

19:06.240 --> 19:11.080
we can do it underneath our inspector tab, underneath our player Skip.

19:11.400 --> 19:15.440
And now we're going to press down Ctrl S in order to save our skip.

19:15.440 --> 19:17.400
And now let's move over to unity.

19:17.640 --> 19:24.400
So underneath our player Skip we will able to notice that film which is our move speed and we can just

19:24.400 --> 19:26.360
adjust underneath our player skip.

19:26.360 --> 19:28.920
We can just make it a little bit faster.

19:28.920 --> 19:32.800
Basically, we just multiply it to move a little bit faster.

19:32.960 --> 19:39.320
And as you can notice, as soon as our players kipchoge's compiles move speed, we can see by default

19:39.320 --> 19:40.360
we set five.

19:40.360 --> 19:46.800
And now if we go ahead and then click on this play button in the top and try to press down A or D key.

19:46.920 --> 19:52.800
You will see this player will start moving to the left or right direction, depending upon which key

19:52.800 --> 19:54.080
we holding down.

19:54.400 --> 20:00.920
So now if I hold down D key, as you can see we're moving a little bit faster basically with five unit

20:00.960 --> 20:02.040
to the right side.

20:02.240 --> 20:09.600
And if we uh if we press down a key, we can see we started moving to the left direction with minus

20:09.600 --> 20:10.640
five unit.

20:10.640 --> 20:15.880
And we can increase or bump up the value as well while we doing in play mode.

20:16.080 --> 20:21.870
But make sure you just get out of play mode and then paste that number once again, because whatever

20:21.870 --> 20:25.670
you're going to do inside play mode, it's not going to be saved at all.

20:25.670 --> 20:32.270
So let's suppose if I move over to my player script and then set this move speed to something like ten,

20:32.310 --> 20:34.950
we can see we're moving more faster.

20:34.950 --> 20:41.590
But if we get out of play mode, uh, as you can see, as soon as we are out of play mode, uh, this

20:41.630 --> 20:44.030
move speed is set back to five.

20:44.030 --> 20:47.510
So whatever you're gonna do, it's not gonna be saved at all.

20:47.510 --> 20:50.350
So make sure you just remember those things.

20:50.350 --> 20:55.790
Or you can simply just right click on this, uh, player script and then click on this copy component

20:55.790 --> 20:57.710
while you are in play mode.

20:57.710 --> 21:04.110
And once you get out of play mode, then you can simply right click on this player script and then this

21:04.150 --> 21:06.670
click on this paste component values.

21:06.670 --> 21:08.070
So it's gonna set back.

21:08.110 --> 21:11.670
Or you can simply remember that number as well.

21:11.670 --> 21:14.590
So I hope you get the idea that how you can do it.

21:14.590 --> 21:17.550
And now we're going to turn this player into a prefab.

21:17.550 --> 21:21.110
So to do that we will head over to Project App Assets.

21:21.110 --> 21:24.710
So let's right click on this Assets Create folder.

21:24.710 --> 21:27.950
And we're going to call this folder to something like prefabs.

21:28.070 --> 21:32.070
So we're creating folder to keep our project clean.

21:32.270 --> 21:35.350
So and we're going to select our player in the hierarchy.

21:35.350 --> 21:39.950
And let's drag it over to that prefabs folder inside a prefab.

21:39.950 --> 21:44.950
So to get our player into a prefab so we will have the copy.

21:44.950 --> 21:51.950
And if we just lose our player in the hierarchy we can just restore it from that prefabs folder.

21:51.950 --> 21:58.270
Or you can press down Ctrl Z to undo anything that you really just want.

21:58.270 --> 22:04.630
If you lost something mistakenly, mistakenly, you just lost.

22:04.630 --> 22:12.070
So you can just press down control plus state to undo anything and we will press down Ctrl plus S to

22:12.110 --> 22:13.550
save our project.

22:13.550 --> 22:17.670
So I hope you get the idea that how you can make the player movement.
