Welcome back my fellow game developers.
And as you can see for the first time,
instead of go moving forward,
we've moved back and we no longer have a background.
We just have this weird world in front of us.
Don't worry about it.
We have the right tools to solve this problem.
So as you can see right now,
we not only have a background,
but we can draw our own background.
I can add whatever I want.
I want to add this one and our world.
Nope way.
I'm going to add this one and it's currently not perfect, but it works.
So I'm going to, for example,
at this one and let's make it on the ground.
There you go, with some blue space behind it,
but no worries, we will be fixing that later on.
But for now, let's understand how we convert
sprites and to tile assets into bile pallets,
into drawing them on the screen,
as you can see, extremely professionally.
So let's not waste any more time.
And let's get started.
Oh, okay, So now we have a solid player,
we have a solid enemy.
We have bullets, we have layers,
We have effects, we have animations, we have everything.
What we don't have is the control over the creativity of our game.
So currently everything that we've created is just on this background.
It's good enough.
We have the box gliders,
we have all of the limits on it,
but it's not enough.
What if we want to create our own level?
Obviously, we can't just go looking for different backgrounds.
This is what we'll do in this video and in this entire section.
Now, let's click on the tile set.
I've created a folder inside of the sprites called the pile set.
I'm going to go into the resources and I'm going to use the catacombs.
Obviously, if you want to use a different tile set,
I do recommend that you go do some research on open game art and add your own.
So there we go.
Now we've added the folder.
If I open this up or maybe I should open it up from here and show you a couple of things.
So you can see that we have these candles,
we have a sprite.
Here you go. You can see this is the sprite.
It's exactly the one that's used in the background.
And actually I've created one,
then used a screenshot and made it a background.
But now we'll learn how to use these squares in order to create a map.
We also have the decorations,
and I've left you,
let's say screenshots or pictures and
the resources that you can check out and see how the world is created.
So without any further or do,
how are we going to do this?
The first thing is we're going to go into the window.
We are going to go into 2D.
And you can see right here that we have something called the tile palette.
So I'm going to click on this and I'm going to add it in here.
And what is the Tile Palette?
Well, it's the tool that Unity has that will allow us to draw different kinds of,
let's say these sprites or the tiles or the tile assets.
And maybe you're confused.
What are we going to do?
How are we going to convert this picture right here and two tiles and start joining?
Well, let me explain using my nifty laser.
So first thing we have the sprite sheet.
You've seen this, you've noticed while I was showing you we have the sprite sheet.
What we'll do is we're going to cut the spreadsheet up.
And we are going to have slices of this sprite sheet.
After we have the slices,
what we'll do is we are going to convert them into tile assets.
And after converting them into tile assets,
we are going to have them in our tile palette.
So you just solve the tile palette that I've added just now.
You'll also see it in just a bit when we convert our sprite and to this one.
And finally, we'll draw them and add the enemy and create all sorts of cool things.
So before I continue on,
I just want to show you the challenge right now.
I shouldn't, but I will because there is the first step in here which is
important what other sprites and tile you choose to use for your gain.
So if you don't like the catacombs,
maybe it's not your style,
it's not part of your game.
Maybe you have different players enemy is you need a different environment.
I do recommend that true.
Go look for 2D sprites.
Maybe have, I don't know,
some futuristic sci-fi city.
Maybe you can create your own if you're that good,
then you need to size them up.
And finally added to the Tile Palette and create your new set.
I'm not going to say pause the video because there you go.
It's pretty simple.
This is the instructions of the challenge.
I'm going to do it in front of you.
So first thing first,
we need to slice up this tile map.
And this is a bit of a tricky thing to do because sometimes you don't get
the best quality and you'll need to
determine how much or what is the size of these slices.
So if I try to do automatic,
There you go, you can see it is kind of sliced,
but I cannot add, for example,
one part of this or a small square from these pieces.
So what I'll have to do is I'll have to go ahead
and choose instead of automatic grid by cell size.
And I'm going to use,
Let's first of all try 64 by 64.
When I slice this, there you go.
You can see now we have adequate slices,
but they are not good enough because let's say I want to draw this,
I need to pick these four slices and you see that this one is not alone.
I'll have to choose these two.
So we need to make it even smaller.
And I know the size.
It should be, I believe, 16 by 16.
And if I slice it up, There you go.
You can see that I have a lot more control over how all of this works.
And you can see how this one is sliced up,
how all of these are sliced up.
They are good enough,
not perfect, but they are good enough,
I believe maybe if you have the skills,
you can go ahead and added them yourself.
See what works, see what doesn't.
But I do recommend you keep all of them 16 by 16 and you'll see why in just a bit.
So I'm going to apply this.
And obviously if you downloaded your own sprites,
then you will have to, of course,
find your own size of slicing.
And for some reason today unity is extremely slow.
So I've applied the changes,
I've sliced everything up.
So now when I go out from the Sprite Editor, there you go.
You can see all the tiles.
Now, what is the next step?
The next step is to go ahead and add them to the Tile Palette.
So now we have sliced up everything.
The next step is to create the tile assets and have them in the Tile Palette.
So what I'm going to do is I'm going to pick
these sliced up Sprite and I'm going to drag it into the nothing.
We need to first of all, create a palette.
So what will be the palette name?
Let's just call it the main catacombs.
Catacombs, that's how we write catacombs create.
Where should we create this?
Well, you can add it either in the sprites
or you can go ahead and create a new asset in here,
which will be the file set or tile palette or whatever you wanna call it,
enter, select the folder,
and there you go.
Now you can drag this.
So you can drag the entire image,
so drag it into the tile palette right here.
Where do you want to save it?
Of course, this is also your choice,
but I will do is I'll go into the tile set in here,
and I'll call this the File Assets folder.
And let's just keep it in the sprites because we have already ignored it.
And I think it's better to ignore
the tile sets because already they are dependent on the sprites.
So it depends on you.
Maybe if you want to keep them,
if you want to allocate a bit more resources in your commits,
I recommend you do that.
If not, I'm going to select this folder.
And now you can see that the sprites are being converted into tile assets.
So I'll use the power of editing and I'll do this in a second.
Oh, okay, welcome back.
So now we have everything set up.
If I make this tile palette a bit bigger, there you go,
you can see all of the sprites that were initially here are right now.
Here.
Now, you may have encountered a lot of problems here,
especially if you try to do something different than 16 by 16,
you'll notice that they are all on top of each other.
It's a bit of a tricky thing to get a hold on.
What I recommend is always have all the sprites sliced
up the same size so you don't have any confusion and drag the entire image,
not every single 11 by one.
So now we have this.
How do we start drawing?
Well, you can see that we have a palette,
we have the assets,
but the active file map is nothing.
So what we're going to do is I'm going to right-click in
here and I'm going to go into the 2D object.
So I've chosen the hierarchy to the objects,
and you can see that I have the option to create a tile map.
And I have many options.
I can create isometric,
rectangular x, ordinal, and et cetera.
But I'm going to do is create a rectangular shape pile map.
And you can see immediately that I have an active tile map right here.
And what I can do is I actually can duplicate this and have a second tile map.
And I can call it, for example, the ground.
And I can call this one the walls.
And now I can choose between walls and the ground.
And why is this important?
Because later on we will need different levels to our game.
You'll see that in the next video when we start adding colliders and et cetera.
But for now, what we're going to do,
we're going to save the sample scene.
And I'm going to go into the scenes folder.
And you can see this is the sample scene.
I will call this the maybe test
one or something or you can call it level one, whatever you want.
I'll call it the best one.
It will ask us to reload.
Reload. I'm going to I'm not sure.
Let's keep the grid right here.
And I'm going to duplicate that one.
So now we have this tool.
Let's go into test2.
You can see the name of the scene change appears,
so it was test one.
Now it's two.
I'm going to delete the background.
So now we have the player and the skeleton just floating in mid air.
And now what we're going to do is I'm going to select the grid,
I'm going to choose the ground for now.
Let's keep everything on the ground and I'm going to start drawing.
So what should we use as the ground?
You can see that this is the,
and I recommend that you go look through the images.
I have left you the examples that you can follow.
But for now, first thing first is we are going to draw the ground.
We can choose from one of these now,
obviously it's not very right. But no worries.
Let's talk about a couple of tools that we have in here.
So first of all, whenever you want to pick,
make sure that you know which tile map you're on.
You'll know why in the next video.
Why is this so important?
Choose one of the tiles.
So I'm going to choose these four.
And now you can see that I can simply click in here,
but they are very small.
So what we always do,
we'll go to the tile set,
will go to the image that we've used.
And we are going to end the Inspector. Let's make it 50.
Apply the changes.
Let's see how big that becomes.
Okay, so it's not enough.
Let's make it 16.
Apply the changes and these should fill up the entire square.
Okay, there we go. So we change the pixel per size.
Pixels per unit, maybe even be,
we should make them even bigger because you can see right here,
there is a small thin blue line which we don't want.
So let's make it around 15.
Apply the changes.
And there we go.
So now we don't have any more of these outlines.
Okay, great.
Let's make sure that they are point filter apply.
So they will become much more crispy.
Okay, there we go. Now back in the Tile Palette, Let's zoom out.
What do we have in here?
We have the ground,
we have the different tiles,
and we have the tools appear.
So if you hover over them,
you can see what each of those tools mean.
This one for the select,
this one can be used for the move.
But the most important three,
I believe, is the paintbrush.
So the paintbrush, how does it work?
So for example, whatever you want right here,
you get the paintbrush and now you can paint it on
your scene right here between the squares.
For example, you can use also this paint, a filled box.
So what you can do is you can choose one of those or you can choose multiple obviously.
And then you can create this kind of look,
can create this whole map using this one.
So it's a very powerful tool to draw faster.
So there you go, you can see,
you can create a lot more,
a lot faster, but it's not very precise.
Then what else do we have?
We have the peak or marquee select.
I've never used it honestly,
the flood fill never used it.
And the arrays, which is very important.
So how do you do this?
You've just like the arrays and if you want,
you can choose a big square,
select the eraser, and there you go,
you can remove everything.
So with that done,
I hope you understood what we did.
I hope you understood how we converted from the sprites to the slice,
to the tile assets,
to the Tile Palette.
And finally how we are creating the tile map.
But for now, I'm going to leave you to your own creativity.
So pause the video right now and try
to create a pile or tile map or any map that you want.
But for now, don't take too much time because in the next video,
we are going to create two different tile maps.
And using those tile maps,
we are going to understand why we need different tile maps for different levels.
And again, so that none.
I hope you enjoy it and I'll see you in the next video.