WEBVTT

00:00.080 --> 00:03.080
Let's drag some sprite, basically player sprite.

00:03.080 --> 00:08.960
So let's head over to this project project app first and then move over to this assets folder.

00:09.000 --> 00:10.920
Then right click on this assets folder.

00:10.920 --> 00:13.560
Then create in the top and select this folder.

00:13.560 --> 00:16.560
And now we're going to call this folder to something like sprites.

00:16.720 --> 00:20.120
So let's call that folder to something like sprites.

00:20.120 --> 00:23.120
And we're going to create a sub folder into this sprite.

00:23.120 --> 00:25.280
So why we created this folder.

00:25.280 --> 00:32.080
Because we want to import all of the sprites that we need into this folder to just keep all of the things

00:32.080 --> 00:33.200
in an organized way.

00:33.200 --> 00:35.440
So that's why we created this folder.

00:35.440 --> 00:40.840
And let's also create a sub folder in in order to drag our player sprite.

00:40.880 --> 00:45.800
So so we're going to create a sub folder and we're going to name it something like player.

00:45.800 --> 00:51.520
And we're going to drag all of the player sprite into that folder to keep all of the things in.

00:53.720 --> 00:57.680
Sorry to keep all of the things clean.

00:57.800 --> 01:00.750
So let's head over to this sprite spread folder.

01:00.750 --> 01:02.950
And let's right click on this sprite folder.

01:02.950 --> 01:05.190
Then create in the top and then folder.

01:05.230 --> 01:06.630
Choose folder in the top.

01:06.870 --> 01:11.870
And I'm going to name this folder or the subfolder as something like player.

01:11.870 --> 01:13.430
So let's call it player.

01:13.550 --> 01:20.270
And now we're going to drag the player sprite into this folder because we're going to have a enemy enemies.

01:20.270 --> 01:23.630
So we're going to create enemy folder and enemy sub folder.

01:23.630 --> 01:27.390
So that's why uh to just keep uh in clean way.

01:27.550 --> 01:33.350
So I already have downloaded in my downloads section and I'm going to select that sprite sheet.

01:33.390 --> 01:36.470
Of course I will have a link in the resources.

01:36.470 --> 01:38.350
You can go and check that out.

01:38.350 --> 01:43.310
So I'm going to select that sprite sheet and drag it over to this player sub folder right away.

01:43.590 --> 01:47.870
And as soon as we drag it we can just see that by double clicking on it.

01:47.870 --> 01:54.470
And if we select the sprite sheet, uh, from that folder from that player sub folder, if we select

01:54.470 --> 01:56.950
that, then go over to Inspector in the right.

01:56.950 --> 02:01.910
And then click on this Open Sprite Editor tab and we're going to click on this apply.

02:02.310 --> 02:06.190
If we have sorry we're going to leave it to automatic.

02:06.190 --> 02:12.270
So if if we take a closer look of this player sprite we can see it seems blurry.

02:12.270 --> 02:16.590
So to get rid of that what we need to do we need to move over to this inspector.

02:16.710 --> 02:17.870
Then scroll down.

02:17.870 --> 02:20.950
We need to choose this filter mode to point no filter.

02:20.950 --> 02:24.150
And after doing that click on this apply button in the bottom.

02:24.150 --> 02:28.430
You will see and as soon as we click apply, the blurry is gone.

02:28.430 --> 02:36.310
By now, as you can see, and what we have to do, we we can see that we have more than one sprite.

02:36.310 --> 02:40.430
So that's why we need to choose this sprite mode to multiple in the inspector.

02:40.430 --> 02:42.310
So make sure you just do that.

02:42.310 --> 02:46.950
And uh, after doing that we will move over to this Sprite editor tab.

02:46.950 --> 02:48.750
In the top left you can see slice.

02:48.750 --> 02:52.390
So just click there and we're gonna leave it to automatic.

02:52.390 --> 02:58.310
And after doing that click on this slice and then click on this apply button in the top right in Sprite

02:58.420 --> 03:02.580
Editor tab and we are now ready to drag our player.

03:02.580 --> 03:04.900
So I'm going to select my game view once again.

03:05.020 --> 03:07.820
And let's select the player game object in the hierarchy.

03:07.820 --> 03:11.500
And we just want to replace this square with our player sprite.

03:11.500 --> 03:14.180
So we're going to head over to that player sprite sheet.

03:14.180 --> 03:19.140
So just go there and then click on this arrow in order to see the individual sprite.

03:19.140 --> 03:22.100
So I'm going to select this one something like this one.

03:22.100 --> 03:27.620
So let's select the player game object in the hierarchy first and then move over to Inspector then Sprite

03:27.620 --> 03:28.420
Renderer.

03:28.420 --> 03:32.900
So we want to change this sprite to a square to this our player sprite.

03:32.940 --> 03:37.100
So we're going to select our player sprite first and drag it over to this field.

03:37.780 --> 03:40.060
This field is sprite field.

03:40.580 --> 03:43.780
Or you can simply say this sprite slot.

03:43.980 --> 03:50.460
But the problem is that as soon as we drag it, our player seems a lot more small.

03:50.460 --> 03:54.460
So what we need to do, we need to make it bigger in size.

03:54.460 --> 03:57.340
So what we have to do, we need to select the sprite sheet.

03:57.340 --> 04:02.690
So select the player sprite sheet one more time, and then go over to Inspector and make this pixel

04:02.690 --> 04:04.850
per unit as something like 16.

04:04.850 --> 04:08.810
So less pixel size means the sprite is just going to be large in size.

04:08.810 --> 04:15.210
So it's going to be a bigger in size and more pixel per unit number means the sprite is going to be

04:15.210 --> 04:16.970
small in size.

04:16.970 --> 04:19.410
So we're going to make it something around 16.

04:19.650 --> 04:25.010
And after doing that, make sure you scroll down and then click on this apply button in the bottom.

04:25.210 --> 04:32.370
As soon as we apply we can see now player game object is a little bit bigger, but we just want to make

04:32.370 --> 04:34.890
it more a little bit more bigger.

04:34.890 --> 04:37.530
So we're going to select our sprite sheet one more time.

04:37.530 --> 04:41.570
Then go over to Inspector and then make this pixel per unit in less number.

04:41.570 --> 04:45.210
So I'm going to make it something like eight I guess it would be fine.

04:45.210 --> 04:46.290
And let's scroll down.

04:46.290 --> 04:50.050
Let's click on this apply button one more time in order to apply.

04:50.050 --> 04:57.450
And we are now able to see our player and what we're going to do now we're going to create a crown in.

04:57.490 --> 05:00.490
In order to top off a land top of that crown.

05:00.490 --> 05:01.490
So let's do that.

05:01.490 --> 05:03.410
So we're going to move over to this hierarchy.

05:03.410 --> 05:05.450
Right click or hit this plus icon.

05:05.450 --> 05:07.010
Then go to 2D objects.

05:07.050 --> 05:07.570
Right.

05:07.570 --> 05:09.490
And then we're going to choose this square.

05:09.690 --> 05:11.890
And let's select the move tool from this scene view.

05:11.890 --> 05:14.170
And we're going to move it somewhere around here.

05:14.170 --> 05:17.970
And let's stretch this square to fit this.

05:17.970 --> 05:19.810
So we're going to make in the X scale.

05:19.810 --> 05:22.530
Or you can simply select this break tool from here.

05:22.730 --> 05:24.650
And we're gonna scale this.

05:24.650 --> 05:30.050
So we're going to hold down alt in order to resize from our center as you can see.

05:30.490 --> 05:32.050
And we need to do something.

05:32.050 --> 05:36.730
But before we do let's rename this square to something like round.

05:36.770 --> 05:38.890
So I'm going to rename this to Crown.

05:39.610 --> 05:41.290
So let's call it crown.

05:41.490 --> 05:49.290
And what we need to do now we need to attach a some components to this crown as well as to this our

05:49.290 --> 05:50.370
player game object.

05:50.370 --> 05:55.690
So if I just go ahead and then click on this play button you will see this player game object just gonna

05:55.920 --> 06:00.960
Uh, fall down, uh, due to gravity, and it's just going to pass through this ground.

06:01.000 --> 06:01.480
Why?

06:01.640 --> 06:06.360
Because we haven't added any colliders to this player as well as to this ground.

06:06.360 --> 06:08.920
So that's why it's going to pass through this ground.

06:09.120 --> 06:15.440
So as you can see, as soon as the game started, our player game object just passes through this ground.

06:15.440 --> 06:21.440
So let's get out of play mode and let's add some components to this ground as well as to this player

06:21.440 --> 06:23.720
in order to land on top of this ground.

06:23.720 --> 06:26.440
So we need to attach a collider.

06:26.440 --> 06:29.600
So we're going to select our player GameObject in the hierarchy first.

06:29.640 --> 06:30.960
Then go over to Inspector.

06:30.960 --> 06:36.000
Click on this add component and we need to add a component called Box Collider 2D.

06:36.000 --> 06:40.160
So when I click on this card in the right side in order to see all of the section.

06:40.160 --> 06:42.120
So I'm going to move over to this physics 2D.

06:42.120 --> 06:48.960
So scroll down a bit then go over to this physics 2D and you need to find box Collider 2D or any Collider

06:48.960 --> 06:49.320
2D.

06:49.320 --> 06:55.080
You you just want to attach, but make sure it just perfectly fits the sprite size.

06:55.080 --> 06:57.590
So that's why we're going to add a box Collider 2D.

06:57.590 --> 07:00.950
So just click there in order to attach the Collider 2D.

07:00.950 --> 07:05.310
And we can see a green outline just attached to this player game object.

07:05.310 --> 07:07.950
Once we click on this box Collider 2D.

07:07.950 --> 07:10.710
So this green outline is our collider.

07:10.710 --> 07:15.790
And we can adjust the collider as well as the size of our player game object.

07:15.790 --> 07:21.270
So to do that make sure you just go to Inspector, then box Collider 2D and then click on this Edit

07:21.270 --> 07:22.110
Collider.

07:22.110 --> 07:25.950
And we're going to edit the Collider as the size of our player's prime.

07:25.990 --> 07:29.230
So let's edit that something like this much.

07:29.510 --> 07:31.990
And I guess this is fine.

07:31.990 --> 07:35.030
And once you're done you can just click on that.

07:35.030 --> 07:39.550
Or you can just click on this Edit Collider over here.

07:39.550 --> 07:43.910
You can click on that in order to just remove that.

07:43.910 --> 07:46.950
Basically we don't want to edit the collider anymore.

07:47.190 --> 07:54.110
And now if we just go ahead and then click on this play button in the top, it should land on top of

07:54.110 --> 07:56.620
this ground, but it's not going to do that.

07:56.660 --> 07:57.020
Why?

07:57.180 --> 08:01.100
Because we also need to attach collider to this ground as well.

08:01.100 --> 08:05.540
So as soon as the game started, our player GameObject just passes through.

08:05.580 --> 08:05.980
Why?

08:06.100 --> 08:11.500
Because we also need to attach a box, collider, 2D, or any collider to this ground.

08:11.500 --> 08:13.340
So it's going to detect the collision.

08:13.340 --> 08:16.620
So that's why it's not detecting the collision anyway.

08:16.620 --> 08:21.180
Because we also need to attach a collider 2D to this ground as well.

08:21.180 --> 08:24.860
So let's get out of play mode by clicking on this play button in the top.

08:24.980 --> 08:27.820
And let's select the ground game object in the hierarchy.

08:27.820 --> 08:31.580
And let's attach a box Collider 2D to this ground as well.

08:31.580 --> 08:35.940
So move over to Inspector, then click on this add component and you.

08:36.060 --> 08:39.700
You can find the component by typing name of the component.

08:39.700 --> 08:42.940
So the component we're looking for is a box Collider 2D.

08:42.940 --> 08:45.620
So we're going to type Box Collider 2D.

08:45.660 --> 08:50.260
As soon as we type it gets pop up in the pop up over here.

08:50.300 --> 08:53.020
And we can just click on that in order to attach.

08:53.220 --> 09:00.060
And if we just scroll our mouse in the scene view in order to take a closer look, we can see a green

09:00.100 --> 09:00.740
outline.

09:00.860 --> 09:06.140
And by now, if we just click on this play button in the top, you will see this player game object

09:06.140 --> 09:08.060
just gonna lay on top of this ground.

09:08.060 --> 09:13.100
But before we do I'm gonna drag this player game object somewhere over here in the top.

09:13.100 --> 09:15.980
So let's select the move tool from here and I'm gonna move it.

09:15.980 --> 09:17.660
Something over here.

09:18.260 --> 09:22.780
And now if we just click on this play button you will see this player game object.

09:22.780 --> 09:24.860
Just gonna lay on top of this ground.

09:24.900 --> 09:25.340
Why?

09:25.460 --> 09:28.380
Because we attached Collider to both of these game objects.

09:28.380 --> 09:30.700
So that's why it's gonna detect the collision.

09:30.980 --> 09:33.540
And it's gonna lay on top of our ground.

09:33.580 --> 09:37.220
So as soon as the game started, we can see this player game object.

09:37.220 --> 09:40.620
Just lay on top of this ground and it's pretty much fine.

09:41.100 --> 09:44.580
And what we're gonna do now, we're going to make our animation.

09:44.780 --> 09:47.260
So we also need to make our animation.

09:47.260 --> 09:52.620
So this is pretty much cool thing I hope you get the idea that how you can do it.

09:52.620 --> 09:58.290
And But before we make the animation, we're going to make this player game object a prefab.

09:58.330 --> 10:03.570
So if we select our player GameObject in the hierarchy, we're going to select our player GameObject

10:03.570 --> 10:08.050
in the hierarchy and drag it over to this project tab first, and then assets folder.

10:08.210 --> 10:09.970
And we need to drag it over here.

10:09.970 --> 10:12.130
So as you can see we just drag it.

10:12.130 --> 10:15.770
So we just made this player GameObject a prefab prefab.

10:15.810 --> 10:18.970
You can simply say a copy of that GameObject.

10:18.970 --> 10:23.570
So in order to make it prefab you need to select GameObject first in the hierarchy.

10:23.570 --> 10:29.810
So in our case this player GameObject and what you have to do, you need to select the GameObject first

10:29.810 --> 10:33.450
in the hierarchy and drag it over to this assets folder.

10:33.890 --> 10:36.010
So it's going to make a prefab.

10:36.170 --> 10:41.290
So and now if we select our player GameObject in the hierarchy and then delete.

10:41.290 --> 10:43.210
As you can see air is gone.

10:43.210 --> 10:46.210
As soon as we just press down delete it's gone.

10:46.210 --> 10:49.130
So we don't have the player game object at all.

10:49.130 --> 10:53.240
But we do know that we just made a prefab of that player game object.

10:53.240 --> 10:59.120
So what we can do, we can just move over to this assets folder and where we drag it, our player game

10:59.160 --> 10:59.520
object.

10:59.520 --> 11:01.560
So over here we can see.

11:01.560 --> 11:05.160
So we can simply select that game object and we drag it.

11:05.200 --> 11:07.760
We can drag it over to this in view directly.

11:07.760 --> 11:10.560
Or we can drag it into this hierarchy as well.

11:10.600 --> 11:14.280
As soon as we drag it, we can see our player game object.

11:14.280 --> 11:20.000
And we don't need to attach this component one more time in order to make, uh, basically add gravity

11:20.000 --> 11:22.120
to this game object, then colliders.

11:22.480 --> 11:25.920
Uh, so we don't need to work from scratch, as you can see.

11:25.960 --> 11:28.680
And we have all of the save option.

11:28.680 --> 11:33.080
So that is the thing making prefab makes our work a lot more easy.

11:33.080 --> 11:37.400
So somehow you lost your GameObject in the hierarchy.

11:37.440 --> 11:41.520
You can restore it directly by making a prefab.

11:41.520 --> 11:46.280
So make sure you just make that prefab and you're gonna have all of the same things.

11:46.280 --> 11:49.840
So that that is the cool thing of making prefab.

11:50.000 --> 11:54.520
And what we're gonna do now we're going to create a prefab folder, and we're going to drag all of the

11:54.520 --> 11:58.880
prefabs into that folder to keep our project clean.

11:58.880 --> 12:02.800
So we're going to move over to we're going to head over to this project at first.

12:02.840 --> 12:05.320
And let's move over to this assets folder.

12:05.320 --> 12:08.520
And let's create a folder for our prefab.

12:08.520 --> 12:10.720
So let's right click on this assets folder.

12:10.720 --> 12:13.560
Or you can just right click over here as well.

12:13.560 --> 12:17.880
Then click on this create in the basically move over to create in the top.

12:17.880 --> 12:19.560
And then click on this folder.

12:19.560 --> 12:22.520
And then we're going to name this folder to something like prefabs.

12:22.680 --> 12:26.000
And we're going to drag all of the prefabs into that folder.

12:26.000 --> 12:28.520
So I'm going to name it to something like prefabs.

12:28.840 --> 12:35.440
And now let's select our player prefab and drag it over to that folder in our assets section.

12:35.440 --> 12:38.280
And now we can see our project is saved.

12:38.320 --> 12:42.760
And we're going to save our project by holding down Ctrl s.

12:42.920 --> 12:50.000
Or we can simply we can simply move over to this top left file and then click on this save in order

12:50.000 --> 12:51.920
to save our project.
