We're going to make the tile.
So let's go to hierarchy.
Then select the grid.
So in our case over here.
So let's select that.
And we're going to select the tile map underneath our grid in hierarchy.
Then in the scene view you you're going to see this open tile palette anywhere in this in view.
So I have in the top left.
So I'm going to drag it.
Sorry I just lost.
So how we can get it back.
We we have it over here.
So I'm going to move it somewhere here.
And let's click on this open tile palette.
So the tile palette just going to open and we're going to paste our tiles.
So I'm going to paste this one sorry.
And this one.
So I'm gonna paste it somewhere here and let's paste it over here something like this.
And let's paste it and I'm going to select all of them.
Let's paste it here and let's choose this one.
And let's paste it here.
And now we're going to select this one.
Let's paste it here.
And we have this.
Awesome.
And we're going to paste it in the middle field.
Let's select this.
And this is going to be over here.
So now we just created this round one game object.
And the thing is that if we just click on this play button but before it I'm going to move my player
game object something over here.
So let's select the player game object in the hierarchy.
And let's select the move tool from our scene view.
And then we're going to move it somewhere around here.
And let's click on this play button in in the top in order to play our game A game.
So you're gonna be able to see this player game object just gonna fall down or just gonna pass through
this ground or this tile map.
As you can see, as soon as the game started, our player game object just passes through this ground
or this grid, or you can simply say the tile map.
Why?
Because we need to add colliders to this tile map as well.
So how we can do that.
So let's get out of play mode.
But before we do we also want to paste our grounds in this tile map.
And we're going to create an another tile map for that because we don't want to add colliders to that
ground.
Sorry to that grass or something like we're gonna have trees.
We're not going to attach any colliders, because if we attach this player game object, not going to
able to just pass it through.
True.
So we're going to create a tile map for our grass as well as for some stuff.
So what you basically need to do.
So make sure you just go to hierarchy first and then select this grid game object.
Right click on it, then go to 2D object sorry 2D object here, and then move over to this tile map.
Scroll down a bit, go to Tile Map and then click on this rectangular rectangular and I'm going to call
this tile map one to something like grass.
So this is going to be grass.
So I'm going to call it grass.
And now what we're going to do we're going to paste our grass or something like that.
So let's do that.
So we're going to select our grass in the hierarchy.
Move over to the scene view and then click on this open tile palette.
And we're going to paste our ground now sorry.
And we have grass or the app.
You can simply say basically this thing and we're going to paste it here and let's paste it this.
And let's paste it here.
I guess it's fine by now.
As you can see.
And we can scroll our mouse to zoom in.
And the grass seems fantastic.
And we're not going to attach any colliders to this ground.
We're only going to attach the colliders to this ground.
Or you can simply say tilemap ground.
So we're going to do that.
So let's do it.
So we're going to select our tile map underneath our game.
Great game object as well as underneath our ground underscore one game object.
So we're going to select our tile map.
So let's call this tile map.
Instead of calling it tile map we're going to say something like ground.
So let's call that something like that.
So we're going to select our tile map underneath our game grid game object in the hierarchy.
Then move over to Inspector.
And we're going to name it over here.
So let's call it ground tiles.
Let's call it ground tiles.
Something like that.
Or you can simply call it ground as well.
Basically, it's totally up to you.
Now let's add colliders to these ground tiles.
So I'm going to select our Ground Tiles GameObject in the hierarchy.
And let's go to Inspector.
Then click on this add component in the bottom.
And we're going to attach a component.
It's called Tilemap Collider because this is a this is tiles.
So that's why we're gonna we're gonna have to add Tilemap Collider.
So you can simply just find the Collider Tilemap Collider by typing name of the component.
So in our case Tilemap Collider, as you can see.
Or you can simply click on Add Component and then click right click the card in the right section you're
going to see.
Then move over to physics 2D and you need to find over here Tilemap Collider 2D.
And if you're not able to find it, you can simply just type a name of the component.
So in our case Tilemap Collider Tilemap Collider.
And we're going to attach that.
So make sure you just click on sorry I just select that type map Collider and it's gonna attach right
away.
And as soon as we just attach Tilemap Collider to this tile ground tiles, we can see individual uh
Tilemap Collider just get attached to individual tiles, as you can see.
So now if we just click on this play button in the top in order to play our game, you will see this
player game object just gonna land on top of this Tilemap Collider or this ground tiles.
Why?
Because we attach, uh, colliders.
So that's why.
As you can see, as soon as the game started, our player game object just gets, uh, fall top of this
ground tiles.
So let's get out of play mode.
But the problem is that if we just click on this play button in the top and try to just jump you.
Not you will see we will not able to, uh, jump because we need to assign this a tile background tiles
as a ground.
So as you can see, we are stuck in the jump animation clip as well as we are not able to jump for the
next time as well.
So let's get out of play mode.
So what we basically have to do, we need to assign this tile map colliders or this ground tile as a
ground tag.
We do know that if this player game object gonna collide with that ground, then this player game object
just gonna able to jump for the next time.
But we do know that we haven't assigned this tile map collider or this ground tile as a ground tag.
So this player game object not able to detect this ground or not.
So that's why we not able to jump.
So we need to assign this ground tiles as a ground tag.
So we know we already created.
So we're going to select our ground tiles or this tile map underneath our grid game object, as well
as underneath our ground underscore one game object in hierarchy.
Then move over to Inspector.
So make sure you select the ground tiles or the tile map.
Then go over to Inspector and then tag.
As you can see it says on tag.
So we're going to assign as a ground.
So this player game object will know this is our ground.
So that's why it's going to able to jump for the next time as well.
So tag as you can see it says tag.
So let's click there and we can assign it ground.
Now we assign it this ground sorry.
These ground tiles as a ground tag as you can see in the inspector or this tile map.
So now if we just click on this play button in the top, you will see.
But before it I'm going to make my player speed a little bit less.
So let's select the player game object in the hierarchy.
Let's move over to Inspector Player Script.
And I'm going to make the speed something like 0.2 or 3 to just for testing purposes.
So let's click on this play button by now and let's have a look on this.
So let's press down space key.
As you can see, as soon as we press press down space key we are able to jump.
And we as well as we able to jump for the next time as well.
Basically, as soon as this player game objects collide with this ground tiles, it's able to jump as
well.
So let's get out of play mode by now.
And if we select our ground tiles or this tile map in the hierarchy, we can see individual tiles.
Let's suppose you just want to compile all of these colliders individual tile map colliders into at
once.
So how you can do that?
In order to do it, you need to attach a composite collider to it.
So what you need to do make sure you select the tile map underneath your create game object or this
ground tiles, whatever.
You just name it, select that first in the hierarchy, then move over to Inspector.
Then click on this add component and you need to attach a component called Composite Collider 2D.
So we're going to find the component by typing.
So as you can see it's pop up.
Let's click there in order to attach.
And by default it just attach this rigid body 2D as well as you can see.
So what we're going to do we're going to set the body type to kinematic.
So it's not going to fall down due to our gravity and collision detection.
We're going to choose continuous and interpolate this one.
Choose interpolate and that's it.
And what we need to do now we need to move over to this tile map collider 2D component in an inspector.
And then you need to move over to this composite operator.
As you can see it says none.
So what we have to do, we need to merge all of these individual tile map collider at once.
So that's why we're going to click on this none.
And we're going to click on this merge in this composite operation operation.
So make sure you you move over to this tile map Collider first, Collider 2D first and then move over
to this composite operation.
And we're going to choose merge.
And as soon as we choose chosen merge, we can see our individual tile map colliders just gets compiled
at once.
Uh, basically it just uh, merge at once, as you can see.
And this seems pretty much, uh, cool.
I hope you get the idea that and we can create as many ground we want.
Uh, but, uh, let's suppose, uh, I just want to like this.
So let's create another one.
But I'll leave it like this.
So let's select our ground one game object.
But before we do, what are we gonna do?
We're gonna define a next point as well.
As you can see, we just created in a empty game object first and we just made it parent barren, as
you can see, and we started pasting our tiles from that point.
And we're gonna also gonna have a next point, something over here.
And why are we gonna create?
Because let's suppose we just want to spawn multiple types of ground.
So we're gonna spawn that from here.
So that's why we're going to create a next point as well.
Like as we created an empty game object first and then we just made it parent in order to just spawn
from that point, the next, uh, ground, you can simply say or to or we just want to spawn the ground
from that point.
So we also going to define a next point or or next position.
You can simply say and from that position we just gonna spawn the next ground.
So that's why we're going to create.
So make sure you select your ground underscore one game object.
Basically the parent you need to select select that, right click on it and then create an empty game
object.
Click on this Create Empty game object and we're going to select our move tool from here.
And we're going to move this position or this game object.
You can simply say something over here.
So it's going to define that if we want to spawn the next round that we're going to spawn it from here.
So that's why we just created an another game object.
So make sure you don't make it.
Underneath this create game object you have to select the parent game object first, right click on
it, then create an empty game object.
And now we're going to move it something over here.
And if you just want to choose an icon then you can move over to this inspector.
Click over here and then you can choose the icon.
So I'm going to select like this.
So we created this point basically in order to spawn the next round from this position.
So that's why and we're going to call it this game object to something like next position.
Or we're going to call it something like next point.
So I'm going to call it next position next position, and we created this one in order to spawn the
next round from this position.
So that's why we just created an empty game object.
And we just move it over here in order to spawn the next one.
So make sure you select your round one underscore one game object or the parent that you made.
Basically select that and just make that one a prefab.
So you're gonna have the copy.
So in my case I'm gonna select my crown underscore one GameObject in the hierarchy.
And let's drag it over to this prefabs folder in our project tab in order to make it prefab.
So we're gonna select our GameObject first underneath uh sorry in the hierarchy.
And let's select that and drag it over to this prefabs folder in this project tab uh firstly this assets
and then prefabs.
Or you can just simply drag it over to this assets folder as well.
Basically it's totally up to you.
And we're going to press down Ctrl S in order to save our project.