WEBVTT

00:00.160 --> 00:01.280
We're going to make the tile.

00:01.280 --> 00:02.960
So let's go to hierarchy.

00:03.000 --> 00:04.800
Then select the grid.

00:05.160 --> 00:07.200
So in our case over here.

00:07.200 --> 00:08.560
So let's select that.

00:08.880 --> 00:12.680
And we're going to select the tile map underneath our grid in hierarchy.

00:13.000 --> 00:18.160
Then in the scene view you you're going to see this open tile palette anywhere in this in view.

00:18.160 --> 00:20.240
So I have in the top left.

00:20.240 --> 00:21.280
So I'm going to drag it.

00:21.600 --> 00:23.360
Sorry I just lost.

00:23.680 --> 00:25.560
So how we can get it back.

00:25.600 --> 00:27.520
We we have it over here.

00:27.800 --> 00:29.920
So I'm going to move it somewhere here.

00:30.120 --> 00:32.400
And let's click on this open tile palette.

00:32.400 --> 00:38.680
So the tile palette just going to open and we're going to paste our tiles.

00:40.080 --> 00:43.120
So I'm going to paste this one sorry.

00:45.040 --> 00:46.800
And this one.

00:46.800 --> 00:55.520
So I'm gonna paste it somewhere here and let's paste it over here something like this.

00:58.440 --> 01:03.790
And let's paste it and I'm going to select all of them.

01:04.030 --> 01:09.990
Let's paste it here and let's choose this one.

01:11.670 --> 01:15.750
And let's paste it here.

01:16.790 --> 01:19.270
And now we're going to select this one.

01:22.190 --> 01:23.710
Let's paste it here.

01:23.990 --> 01:25.670
And we have this.

01:26.510 --> 01:27.230
Awesome.

01:27.430 --> 01:31.430
And we're going to paste it in the middle field.

01:32.910 --> 01:34.150
Let's select this.

01:37.670 --> 01:40.230
And this is going to be over here.

01:40.470 --> 01:44.150
So now we just created this round one game object.

01:44.310 --> 01:49.670
And the thing is that if we just click on this play button but before it I'm going to move my player

01:49.710 --> 01:51.710
game object something over here.

01:51.710 --> 01:54.190
So let's select the player game object in the hierarchy.

01:54.190 --> 01:57.550
And let's select the move tool from our scene view.

01:57.550 --> 02:00.170
And then we're going to move it somewhere around here.

02:00.490 --> 02:06.250
And let's click on this play button in in the top in order to play our game A game.

02:06.450 --> 02:12.090
So you're gonna be able to see this player game object just gonna fall down or just gonna pass through

02:12.090 --> 02:14.250
this ground or this tile map.

02:14.250 --> 02:20.610
As you can see, as soon as the game started, our player game object just passes through this ground

02:20.610 --> 02:23.650
or this grid, or you can simply say the tile map.

02:23.690 --> 02:24.090
Why?

02:24.250 --> 02:27.930
Because we need to add colliders to this tile map as well.

02:27.930 --> 02:29.450
So how we can do that.

02:29.450 --> 02:31.090
So let's get out of play mode.

02:33.050 --> 02:38.930
But before we do we also want to paste our grounds in this tile map.

02:38.930 --> 02:45.410
And we're going to create an another tile map for that because we don't want to add colliders to that

02:45.410 --> 02:45.970
ground.

02:46.090 --> 02:49.890
Sorry to that grass or something like we're gonna have trees.

02:49.930 --> 02:55.450
We're not going to attach any colliders, because if we attach this player game object, not going to

02:55.490 --> 02:57.130
able to just pass it through.

02:57.130 --> 02:57.240
True.

02:57.440 --> 03:02.600
So we're going to create a tile map for our grass as well as for some stuff.

03:02.600 --> 03:04.560
So what you basically need to do.

03:04.560 --> 03:08.960
So make sure you just go to hierarchy first and then select this grid game object.

03:08.960 --> 03:15.800
Right click on it, then go to 2D object sorry 2D object here, and then move over to this tile map.

03:16.080 --> 03:22.560
Scroll down a bit, go to Tile Map and then click on this rectangular rectangular and I'm going to call

03:22.560 --> 03:25.240
this tile map one to something like grass.

03:25.240 --> 03:26.840
So this is going to be grass.

03:26.840 --> 03:28.640
So I'm going to call it grass.

03:29.080 --> 03:34.360
And now what we're going to do we're going to paste our grass or something like that.

03:34.360 --> 03:35.520
So let's do that.

03:35.520 --> 03:38.440
So we're going to select our grass in the hierarchy.

03:38.560 --> 03:42.640
Move over to the scene view and then click on this open tile palette.

03:42.640 --> 03:46.560
And we're going to paste our ground now sorry.

03:46.960 --> 03:50.000
And we have grass or the app.

03:50.040 --> 03:57.670
You can simply say basically this thing and we're going to paste it here and let's paste it this.

04:03.310 --> 04:04.990
And let's paste it here.

04:05.350 --> 04:07.230
I guess it's fine by now.

04:07.270 --> 04:08.350
As you can see.

04:08.510 --> 04:11.790
And we can scroll our mouse to zoom in.

04:12.550 --> 04:15.230
And the grass seems fantastic.

04:15.390 --> 04:19.310
And we're not going to attach any colliders to this ground.

04:19.350 --> 04:22.430
We're only going to attach the colliders to this ground.

04:22.590 --> 04:25.110
Or you can simply say tilemap ground.

04:25.110 --> 04:26.270
So we're going to do that.

04:26.270 --> 04:27.470
So let's do it.

04:27.470 --> 04:30.550
So we're going to select our tile map underneath our game.

04:30.590 --> 04:35.790
Great game object as well as underneath our ground underscore one game object.

04:36.950 --> 04:38.910
So we're going to select our tile map.

04:38.910 --> 04:40.630
So let's call this tile map.

04:40.630 --> 04:44.190
Instead of calling it tile map we're going to say something like ground.

04:44.190 --> 04:46.230
So let's call that something like that.

04:46.230 --> 04:51.110
So we're going to select our tile map underneath our game grid game object in the hierarchy.

04:51.310 --> 04:52.990
Then move over to Inspector.

04:52.990 --> 04:54.630
And we're going to name it over here.

04:54.630 --> 04:56.810
So let's call it ground tiles.

04:57.090 --> 04:58.730
Let's call it ground tiles.

04:59.130 --> 04:59.930
Something like that.

04:59.930 --> 05:03.290
Or you can simply call it ground as well.

05:03.330 --> 05:05.210
Basically, it's totally up to you.

05:05.210 --> 05:08.410
Now let's add colliders to these ground tiles.

05:08.410 --> 05:11.810
So I'm going to select our Ground Tiles GameObject in the hierarchy.

05:12.210 --> 05:13.650
And let's go to Inspector.

05:13.650 --> 05:16.450
Then click on this add component in the bottom.

05:16.450 --> 05:18.530
And we're going to attach a component.

05:18.530 --> 05:20.490
And we're going to attach a component.

05:20.730 --> 05:24.890
It's called Tilemap Collider because this is a this is tiles.

05:24.890 --> 05:28.970
So that's why we're gonna we're gonna have to add Tilemap Collider.

05:28.970 --> 05:35.370
So you can simply just find the Collider Tilemap Collider by typing name of the component.

05:35.370 --> 05:38.650
So in our case Tilemap Collider, as you can see.

05:38.690 --> 05:45.010
Or you can simply click on Add Component and then click right click the card in the right section you're

05:45.010 --> 05:45.610
going to see.

05:45.850 --> 05:51.010
Then move over to physics 2D and you need to find over here Tilemap Collider 2D.

05:51.410 --> 05:56.640
And if you're not able to find it, you can simply just type a name of the component.

05:56.640 --> 06:01.000
So in our case Tilemap Collider Tilemap Collider.

06:01.000 --> 06:02.360
And we're going to attach that.

06:02.360 --> 06:08.480
So make sure you just click on sorry I just select that type map Collider and it's gonna attach right

06:08.480 --> 06:08.920
away.

06:09.160 --> 06:16.600
And as soon as we just attach Tilemap Collider to this tile ground tiles, we can see individual uh

06:16.880 --> 06:22.320
Tilemap Collider just get attached to individual tiles, as you can see.

06:22.600 --> 06:28.720
So now if we just click on this play button in the top in order to play our game, you will see this

06:28.720 --> 06:33.680
player game object just gonna land on top of this Tilemap Collider or this ground tiles.

06:33.720 --> 06:34.000
Why?

06:34.040 --> 06:36.400
Because we attach, uh, colliders.

06:36.400 --> 06:37.160
So that's why.

06:37.200 --> 06:44.240
As you can see, as soon as the game started, our player game object just gets, uh, fall top of this

06:44.240 --> 06:45.320
ground tiles.

06:45.320 --> 06:47.080
So let's get out of play mode.

06:47.440 --> 06:53.670
But the problem is that if we just click on this play button in the top and try to just jump you.

06:53.710 --> 07:01.710
Not you will see we will not able to, uh, jump because we need to assign this a tile background tiles

07:01.710 --> 07:03.710
as a ground.

07:03.710 --> 07:11.070
So as you can see, we are stuck in the jump animation clip as well as we are not able to jump for the

07:11.070 --> 07:12.710
next time as well.

07:12.710 --> 07:13.990
So let's get out of play mode.

07:13.990 --> 07:21.270
So what we basically have to do, we need to assign this tile map colliders or this ground tile as a

07:21.270 --> 07:22.150
ground tag.

07:22.190 --> 07:27.950
We do know that if this player game object gonna collide with that ground, then this player game object

07:27.950 --> 07:30.670
just gonna able to jump for the next time.

07:30.670 --> 07:36.950
But we do know that we haven't assigned this tile map collider or this ground tile as a ground tag.

07:36.950 --> 07:40.950
So this player game object not able to detect this ground or not.

07:40.950 --> 07:43.310
So that's why we not able to jump.

07:43.310 --> 07:47.510
So we need to assign this ground tiles as a ground tag.

07:47.710 --> 07:49.870
So we know we already created.

07:49.870 --> 07:55.490
So we're going to select our ground tiles or this tile map underneath our grid game object, as well

07:55.490 --> 07:59.610
as underneath our ground underscore one game object in hierarchy.

07:59.890 --> 08:01.490
Then move over to Inspector.

08:01.490 --> 08:04.450
So make sure you select the ground tiles or the tile map.

08:04.450 --> 08:07.130
Then go over to Inspector and then tag.

08:07.170 --> 08:09.170
As you can see it says on tag.

08:09.170 --> 08:11.090
So we're going to assign as a ground.

08:11.090 --> 08:14.010
So this player game object will know this is our ground.

08:14.010 --> 08:18.250
So that's why it's going to able to jump for the next time as well.

08:18.250 --> 08:20.690
So tag as you can see it says tag.

08:20.690 --> 08:23.530
So let's click there and we can assign it ground.

08:23.570 --> 08:25.970
Now we assign it this ground sorry.

08:26.010 --> 08:31.690
These ground tiles as a ground tag as you can see in the inspector or this tile map.

08:31.690 --> 08:35.090
So now if we just click on this play button in the top, you will see.

08:35.130 --> 08:38.810
But before it I'm going to make my player speed a little bit less.

08:39.330 --> 08:41.890
So let's select the player game object in the hierarchy.

08:41.890 --> 08:44.330
Let's move over to Inspector Player Script.

08:44.490 --> 08:52.160
And I'm going to make the speed something like 0.2 or 3 to just for testing purposes.

08:52.160 --> 08:56.720
So let's click on this play button by now and let's have a look on this.

09:04.360 --> 09:05.880
So let's press down space key.

09:05.920 --> 09:10.960
As you can see, as soon as we press press down space key we are able to jump.

09:10.960 --> 09:16.080
And we as well as we able to jump for the next time as well.

09:16.120 --> 09:22.640
Basically, as soon as this player game objects collide with this ground tiles, it's able to jump as

09:22.640 --> 09:22.880
well.

09:22.880 --> 09:25.200
So let's get out of play mode by now.

09:25.360 --> 09:31.840
And if we select our ground tiles or this tile map in the hierarchy, we can see individual tiles.

09:31.880 --> 09:38.880
Let's suppose you just want to compile all of these colliders individual tile map colliders into at

09:38.920 --> 09:39.200
once.

09:39.200 --> 09:40.840
So how you can do that?

09:41.320 --> 09:45.560
In order to do it, you need to attach a composite collider to it.

09:45.560 --> 09:51.430
So what you need to do make sure you select the tile map underneath your create game object or this

09:51.430 --> 09:52.990
ground tiles, whatever.

09:52.990 --> 09:57.590
You just name it, select that first in the hierarchy, then move over to Inspector.

09:57.630 --> 10:03.390
Then click on this add component and you need to attach a component called Composite Collider 2D.

10:03.390 --> 10:05.510
So we're going to find the component by typing.

10:05.510 --> 10:07.430
So as you can see it's pop up.

10:07.470 --> 10:09.870
Let's click there in order to attach.

10:09.870 --> 10:15.110
And by default it just attach this rigid body 2D as well as you can see.

10:15.110 --> 10:18.310
So what we're going to do we're going to set the body type to kinematic.

10:18.550 --> 10:23.070
So it's not going to fall down due to our gravity and collision detection.

10:23.070 --> 10:26.310
We're going to choose continuous and interpolate this one.

10:26.310 --> 10:28.950
Choose interpolate and that's it.

10:28.950 --> 10:36.150
And what we need to do now we need to move over to this tile map collider 2D component in an inspector.

10:36.150 --> 10:39.390
And then you need to move over to this composite operator.

10:39.390 --> 10:41.110
As you can see it says none.

10:41.110 --> 10:46.630
So what we have to do, we need to merge all of these individual tile map collider at once.

10:46.630 --> 10:48.970
So that's why we're going to click on this none.

10:48.970 --> 10:53.090
And we're going to click on this merge in this composite operation operation.

10:53.090 --> 10:59.330
So make sure you you move over to this tile map Collider first, Collider 2D first and then move over

10:59.330 --> 11:01.170
to this composite operation.

11:01.170 --> 11:02.570
And we're going to choose merge.

11:02.610 --> 11:09.890
And as soon as we choose chosen merge, we can see our individual tile map colliders just gets compiled

11:09.930 --> 11:10.690
at once.

11:10.970 --> 11:15.530
Uh, basically it just uh, merge at once, as you can see.

11:15.650 --> 11:18.010
And this seems pretty much, uh, cool.

11:18.730 --> 11:23.610
I hope you get the idea that and we can create as many ground we want.

11:24.010 --> 11:28.530
Uh, but, uh, let's suppose, uh, I just want to like this.

11:28.530 --> 11:30.370
So let's create another one.

11:30.370 --> 11:32.490
But I'll leave it like this.

11:32.970 --> 11:35.250
So let's select our ground one game object.

11:35.250 --> 11:37.370
But before we do, what are we gonna do?

11:37.410 --> 11:40.170
We're gonna define a next point as well.

11:40.210 --> 11:46.800
As you can see, we just created in a empty game object first and we just made it parent barren, as

11:46.800 --> 11:51.200
you can see, and we started pasting our tiles from that point.

11:51.200 --> 11:56.040
And we're gonna also gonna have a next point, something over here.

11:56.080 --> 11:57.760
And why are we gonna create?

11:57.760 --> 12:02.800
Because let's suppose we just want to spawn multiple types of ground.

12:02.800 --> 12:05.000
So we're gonna spawn that from here.

12:05.000 --> 12:08.000
So that's why we're going to create a next point as well.

12:08.000 --> 12:15.800
Like as we created an empty game object first and then we just made it parent in order to just spawn

12:15.800 --> 12:23.160
from that point, the next, uh, ground, you can simply say or to or we just want to spawn the ground

12:23.160 --> 12:24.280
from that point.

12:24.280 --> 12:28.600
So we also going to define a next point or or next position.

12:28.600 --> 12:33.640
You can simply say and from that position we just gonna spawn the next ground.

12:33.640 --> 12:35.200
So that's why we're going to create.

12:35.200 --> 12:38.920
So make sure you select your ground underscore one game object.

12:38.920 --> 12:44.800
Basically the parent you need to select select that, right click on it and then create an empty game

12:44.840 --> 12:45.200
object.

12:45.310 --> 12:50.070
Click on this Create Empty game object and we're going to select our move tool from here.

12:50.070 --> 12:53.030
And we're going to move this position or this game object.

12:53.030 --> 12:55.630
You can simply say something over here.

12:55.630 --> 13:01.510
So it's going to define that if we want to spawn the next round that we're going to spawn it from here.

13:01.510 --> 13:04.990
So that's why we just created an another game object.

13:04.990 --> 13:07.230
So make sure you don't make it.

13:07.230 --> 13:12.750
Underneath this create game object you have to select the parent game object first, right click on

13:12.750 --> 13:15.510
it, then create an empty game object.

13:15.510 --> 13:19.350
And now we're going to move it something over here.

13:19.550 --> 13:24.110
And if you just want to choose an icon then you can move over to this inspector.

13:24.110 --> 13:26.830
Click over here and then you can choose the icon.

13:26.830 --> 13:28.390
So I'm going to select like this.

13:28.390 --> 13:33.750
So we created this point basically in order to spawn the next round from this position.

13:33.750 --> 13:38.390
So that's why and we're going to call it this game object to something like next position.

13:38.390 --> 13:41.350
Or we're going to call it something like next point.

13:41.350 --> 13:49.650
So I'm going to call it next position next position, and we created this one in order to spawn the

13:49.650 --> 13:51.530
next round from this position.

13:51.530 --> 13:54.690
So that's why we just created an empty game object.

13:54.690 --> 13:59.250
And we just move it over here in order to spawn the next one.

13:59.730 --> 14:05.250
So make sure you select your round one underscore one game object or the parent that you made.

14:05.250 --> 14:08.970
Basically select that and just make that one a prefab.

14:08.970 --> 14:10.570
So you're gonna have the copy.

14:10.570 --> 14:15.170
So in my case I'm gonna select my crown underscore one GameObject in the hierarchy.

14:15.170 --> 14:21.130
And let's drag it over to this prefabs folder in our project tab in order to make it prefab.

14:21.130 --> 14:25.450
So we're gonna select our GameObject first underneath uh sorry in the hierarchy.

14:25.610 --> 14:32.130
And let's select that and drag it over to this prefabs folder in this project tab uh firstly this assets

14:32.130 --> 14:33.330
and then prefabs.

14:33.370 --> 14:37.610
Or you can just simply drag it over to this assets folder as well.

14:37.650 --> 14:39.730
Basically it's totally up to you.

14:39.730 --> 14:43.730
And we're going to press down Ctrl S in order to save our project.
