Let's drag some sprite, basically player sprite.
So let's head over to this project project app first and then move over to this assets folder.
Then right click on this assets folder.
Then create in the top and select this folder.
And now we're going to call this folder to something like sprites.
So let's call that folder to something like sprites.
And we're going to create a sub folder into this sprite.
So why we created this folder.
Because we want to import all of the sprites that we need into this folder to just keep all of the things
in an organized way.
So that's why we created this folder.
And let's also create a sub folder in in order to drag our player sprite.
So so we're going to create a sub folder and we're going to name it something like player.
And we're going to drag all of the player sprite into that folder to keep all of the things in.
Sorry to keep all of the things clean.
So let's head over to this sprite spread folder.
And let's right click on this sprite folder.
Then create in the top and then folder.
Choose folder in the top.
And I'm going to name this folder or the subfolder as something like player.
So let's call it player.
And now we're going to drag the player sprite into this folder because we're going to have a enemy enemies.
So we're going to create enemy folder and enemy sub folder.
So that's why uh to just keep uh in clean way.
So I already have downloaded in my downloads section and I'm going to select that sprite sheet.
Of course I will have a link in the resources.
You can go and check that out.
So I'm going to select that sprite sheet and drag it over to this player sub folder right away.
And as soon as we drag it we can just see that by double clicking on it.
And if we select the sprite sheet, uh, from that folder from that player sub folder, if we select
that, then go over to Inspector in the right.
And then click on this Open Sprite Editor tab and we're going to click on this apply.
If we have sorry we're going to leave it to automatic.
So if if we take a closer look of this player sprite we can see it seems blurry.
So to get rid of that what we need to do we need to move over to this inspector.
Then scroll down.
We need to choose this filter mode to point no filter.
And after doing that click on this apply button in the bottom.
You will see and as soon as we click apply, the blurry is gone.
By now, as you can see, and what we have to do, we we can see that we have more than one sprite.
So that's why we need to choose this sprite mode to multiple in the inspector.
So make sure you just do that.
And uh, after doing that we will move over to this Sprite editor tab.
In the top left you can see slice.
So just click there and we're gonna leave it to automatic.
And after doing that click on this slice and then click on this apply button in the top right in Sprite
Editor tab and we are now ready to drag our player.
So I'm going to select my game view once again.
And let's select the player game object in the hierarchy.
And we just want to replace this square with our player sprite.
So we're going to head over to that player sprite sheet.
So just go there and then click on this arrow in order to see the individual sprite.
So I'm going to select this one something like this one.
So let's select the player game object in the hierarchy first and then move over to Inspector then Sprite
Renderer.
So we want to change this sprite to a square to this our player sprite.
So we're going to select our player sprite first and drag it over to this field.
This field is sprite field.
Or you can simply say this sprite slot.
But the problem is that as soon as we drag it, our player seems a lot more small.
So what we need to do, we need to make it bigger in size.
So what we have to do, we need to select the sprite sheet.
So select the player sprite sheet one more time, and then go over to Inspector and make this pixel
per unit as something like 16.
So less pixel size means the sprite is just going to be large in size.
So it's going to be a bigger in size and more pixel per unit number means the sprite is going to be
small in size.
So we're going to make it something around 16.
And after doing that, make sure you scroll down and then click on this apply button in the bottom.
As soon as we apply we can see now player game object is a little bit bigger, but we just want to make
it more a little bit more bigger.
So we're going to select our sprite sheet one more time.
Then go over to Inspector and then make this pixel per unit in less number.
So I'm going to make it something like eight I guess it would be fine.
And let's scroll down.
Let's click on this apply button one more time in order to apply.
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.
In order to top off a land top of that crown.
So let's do that.
So we're going to move over to this hierarchy.
Right click or hit this plus icon.
Then go to 2D objects.
Right.
And then we're going to choose this square.
And let's select the move tool from this scene view.
And we're going to move it somewhere around here.
And let's stretch this square to fit this.
So we're going to make in the X scale.
Or you can simply select this break tool from here.
And we're gonna scale this.
So we're going to hold down alt in order to resize from our center as you can see.
And we need to do something.
But before we do let's rename this square to something like round.
So I'm going to rename this to Crown.
So let's call it crown.
And what we need to do now we need to attach a some components to this crown as well as to this our
player game object.
So if I just go ahead and then click on this play button you will see this player game object just gonna
Uh, fall down, uh, due to gravity, and it's just going to pass through this ground.
Why?
Because we haven't added any colliders to this player as well as to this ground.
So that's why it's going to pass through this ground.
So as you can see, as soon as the game started, our player game object just passes through this ground.
So let's get out of play mode and let's add some components to this ground as well as to this player
in order to land on top of this ground.
So we need to attach a collider.
So we're going to select our player GameObject in the hierarchy first.
Then go over to Inspector.
Click on this add component and we need to add a component called Box Collider 2D.
So when I click on this card in the right side in order to see all of the section.
So I'm going to move over to this physics 2D.
So scroll down a bit then go over to this physics 2D and you need to find box Collider 2D or any Collider
2D.
You you just want to attach, but make sure it just perfectly fits the sprite size.
So that's why we're going to add a box Collider 2D.
So just click there in order to attach the Collider 2D.
And we can see a green outline just attached to this player game object.
Once we click on this box Collider 2D.
So this green outline is our collider.
And we can adjust the collider as well as the size of our player game object.
So to do that make sure you just go to Inspector, then box Collider 2D and then click on this Edit
Collider.
And we're going to edit the Collider as the size of our player's prime.
So let's edit that something like this much.
And I guess this is fine.
And once you're done you can just click on that.
Or you can just click on this Edit Collider over here.
You can click on that in order to just remove that.
Basically we don't want to edit the collider anymore.
And now if we just go ahead and then click on this play button in the top, it should land on top of
this ground, but it's not going to do that.
Why?
Because we also need to attach collider to this ground as well.
So as soon as the game started, our player GameObject just passes through.
Why?
Because we also need to attach a box, collider, 2D, or any collider to this ground.
So it's going to detect the collision.
So that's why it's not detecting the collision anyway.
Because we also need to attach a collider 2D to this ground as well.
So let's get out of play mode by clicking on this play button in the top.
And let's select the ground game object in the hierarchy.
And let's attach a box Collider 2D to this ground as well.
So move over to Inspector, then click on this add component and you.
You can find the component by typing name of the component.
So the component we're looking for is a box Collider 2D.
So we're going to type Box Collider 2D.
As soon as we type it gets pop up in the pop up over here.
And we can just click on that in order to attach.
And if we just scroll our mouse in the scene view in order to take a closer look, we can see a green
outline.
And by now, if we just click on this play button in the top, you will see this player game object
just gonna lay on top of this ground.
But before we do I'm gonna drag this player game object somewhere over here in the top.
So let's select the move tool from here and I'm gonna move it.
Something over here.
And now if we just click on this play button you will see this player game object.
Just gonna lay on top of this ground.
Why?
Because we attached Collider to both of these game objects.
So that's why it's gonna detect the collision.
And it's gonna lay on top of our ground.
So as soon as the game started, we can see this player game object.
Just lay on top of this ground and it's pretty much fine.
And what we're gonna do now, we're going to make our animation.
So we also need to make our animation.
So this is pretty much cool thing I hope you get the idea that how you can do it.
And But before we make the animation, we're going to make this player game object a prefab.
So if we select our player GameObject in the hierarchy, we're going to select our player GameObject
in the hierarchy and drag it over to this project tab first, and then assets folder.
And we need to drag it over here.
So as you can see we just drag it.
So we just made this player GameObject a prefab prefab.
You can simply say a copy of that GameObject.
So in order to make it prefab you need to select GameObject first in the hierarchy.
So in our case this player GameObject and what you have to do, you need to select the GameObject first
in the hierarchy and drag it over to this assets folder.
So it's going to make a prefab.
So and now if we select our player GameObject in the hierarchy and then delete.
As you can see air is gone.
As soon as we just press down delete it's gone.
So we don't have the player game object at all.
But we do know that we just made a prefab of that player game object.
So what we can do, we can just move over to this assets folder and where we drag it, our player game
object.
So over here we can see.
So we can simply select that game object and we drag it.
We can drag it over to this in view directly.
Or we can drag it into this hierarchy as well.
As soon as we drag it, we can see our player game object.
And we don't need to attach this component one more time in order to make, uh, basically add gravity
to this game object, then colliders.
Uh, so we don't need to work from scratch, as you can see.
And we have all of the save option.
So that is the thing making prefab makes our work a lot more easy.
So somehow you lost your GameObject in the hierarchy.
You can restore it directly by making a prefab.
So make sure you just make that prefab and you're gonna have all of the same things.
So that that is the cool thing of making prefab.
And what we're gonna do now we're going to create a prefab folder, and we're going to drag all of the
prefabs into that folder to keep our project clean.
So we're going to move over to we're going to head over to this project at first.
And let's move over to this assets folder.
And let's create a folder for our prefab.
So let's right click on this assets folder.
Or you can just right click over here as well.
Then click on this create in the basically move over to create in the top.
And then click on this folder.
And then we're going to name this folder to something like prefabs.
And we're going to drag all of the prefabs into that folder.
So I'm going to name it to something like prefabs.
And now let's select our player prefab and drag it over to that folder in our assets section.
And now we can see our project is saved.
And we're going to save our project by holding down Ctrl s.
Or we can simply we can simply move over to this top left file and then click on this save in order
to save our project.