To replace this square with our enemy sprites.
So I have it.
So I'm gonna head over to my project app assets and then sprites folder, then anime folder, then E1
folder.
I have a lot of sprites, as you can see.
Of course I will have in the resources.
You can go and check that out.
Basically you can download the resources.
So I'm going to select this green one.
So let's select that sprite sheet.
Go over to Inspector.
Click on Open Sprite Editor so we can see we have more than one sprite basically multiple.
So that's why we're gonna choose sprite mode to multiple in the inspector.
And let's choose a pixel per unit to something like 16 and filter mode.
We're gonna choose Point of filter to get rid of blurry.
And let's click on this apply button in the bottom by scrolling down.
And instead of slicing automatically, we're gonna slice grid by cell count.
To do so, let's click on this slice in the top left in our Sprite Editor tab, and let's select automatic
to create by cell count.
And let's count how many columns and rows we have.
So 123456789
1011.
So 11 columns and five rows.
I'm going to put.
And after doing that let's click on slice then apply.
And let's select the game view once again.
And if we move over to that sprite and then click on this arrow we can see the individual sprite.
So what we can simply do if we right click on this and then click on this properties in the in the bottom
we can see the sprites.
So let's choose the first sprite.
And we will replace this square.
So we can simply select our enemy GameObject in the hierarchy.
Then go over to Inspector Sprite, Renderer component and sprite.
As you can see it says square instead of square.
We can select our.
Let's select the first sprite of that, make sure you click on this arrow, then select the first one.
Then drag it over to this sprite slot.
And as soon as we drag it, we can see by now we have our enemy.
But the problem is that it's facing to the right direction, and we want this enemy to face to the left
direction in the direction is player is going, or basically player is facing.
So what we can simply do, we can select our enemy in the hierarchy, then go over to Inspector Sprite
renderer component.
And we can see in our sprite renderer component flip in the x or Y basically horizontally as well as
we can flip this enemy vertically.
So we want this enemy to flip to the x axis or horizontally.
So we're going to check this x box.
And as soon as we check we can see it's now facing to the left direction.
And we need to adjust the collider as the size of our enemy sprite.
So let's click on this box Collider 2D.
Let's click on this Edit Collider.
Or you can simply click over here as well in the same view to edit the Collider.
And let's edit the collider as the size of our enemy.
Something like this much?
Let's make it.
Now this seems pretty much fine, and we can select our enemy and select this move tool.
In the scene view, we can just move a little bit up and let's add our rigidbody 2D for gravity.
So let's click on this add component and let's search for rigidbody 2D.
And let's attach that.
And what we will do.
We're gonna increase the gravity scale a little bit up.
So let's make gravity scale to three and collision detection to continuous.
And we will choose interpolate to interpolate to making a little bit smooth.
And we're gonna freeze the rotation about z axis.
And now it's done.
And you can increase the mass as well if you want to make your anime a little bit heavy.
So I'm gonna make the mask something around five and we can create the animation by now.
So let's do that.
But before we do, let's select the sprite sheet from that folder.
Then right click on it and then click on this properties in the bottom.
And we can see these tabs.
Just open it up and we can just scale this up a little bit.
This from the bottom.
And we can notice that first five sprite of this anime is idle 12345.
As you can see, if you're not doing then you can just select that sprite sheet, go over to Inspector,
click on Open Sprite Editor and we can just take a look right over here as well.
We can see 1234, five.
Sprites is the ideal of this anime.
So we can just make the animation by now or what you can do.
I'm going to select my game view right over here.
We can simply select that Spritesheet.
We can right click on it and then click on this properties.
And we can see the now new tab.
Just open it up.
And this is pretty much fine.
So we can see first five five sprite of this anime is idle.
So when I click on that sprite sheet to see the individual sprite and we're gonna select first five
five sprite 12345 by holding down shift.
And then what you have to do, you just drag it over to anime GameObject in the hierarchy.
Top of this anime GameObject in the hierarchy to make the animation right away as we have done player
a GameObject.
Basically we doing the same thing.
So in the top left we can see assets.
So let's click there and in assets we can see we already created a animations folder.
So let's open that up.
And let's create another sub folder for this These enemies.
So let's right click then new a new folder.
And I'm going to call this folder to something like enemy underscore animation animations.
And let's hit enter.
Let's open up that subfolder as well by double clicking on it.
So since this just gonna, just gonna be our first enemy.
So let's create another subfolder inside this enemy underscore animations folder for this first enemy.
So let's right click then new folder.
And let's call this folder to something like enemy one underscore animation animation.
And let's open this up folder as well by double clicking on it.
And we have to name the animation.
So this will be first enemy.
And the animation is idle.
So we're gonna call this one enemy one enemy one underscore idle.
And then after doing that, let's click on this save button.
Uh, now it's gonna make the animation right away.
So if we select I'm gonna cut this step for now.
Or we can simply drag it right over here.
You can toggle it anywhere you want and less simply clicking over here.
Or you can simply just move it by holding down, basically clicking your mouse button.
And you can move it anywhere you like.
Or you can simply cut this for now, and let's select the enemy GameObject in the hierarchy.
And if we move over to animation tab and then click on this play button, we can see it's now playing
the Idle Animation clip.
So we're gonna have the arrow shooting animation clip.
So let's create those.
So let's head over to project tab.
And before we create we need to make sure uh, that uh how many sprites we have for our enemy.
Uh, fire up uh, arrow fire up animations.
So let's right click on this.
Let's click on this properties.
And we can see
1123456789
1011.
So 11 from here.
So this first five sprites.
Really sorry this first sprites is idle.
So we're going to select from here.
And let's count it 11 sprites we have for showing out our array.
So one.
So this is the first 123456789
1011.
So we're going to select from 11 by holding down shift.
And let's drag it over to this anime GameObject in the hierarchy.
Top of this anime GameObject in the hierarchy.
So let's go to Assets animation folder, any anime animations folder, anime one animation folder,
and we're going to call this one anime one arrow shooting fire arrow or let's call a arrow fire.
Let's call arrow fire and let's click on hit enter.
Or you can simply click on that save button as well.
And let's suppose you just want to zoom a little bit.
Then in the bottom right we can see in our project tab we can just scale this up in order to see perfectly.
But I'm gonna leave with this.
And if we select our enemy go over to animation tab.
Then click here and then choose this enemy one.
Underscore an arrow fire and then click on this play button.
We can see it's shooting out the array as arrow.
And also we're going to create some other animation clip which is this anime heart and the anime date.
So let's do that.
So let's head over to project tab one more time.
Let's select this sprite editor.
Let's right sorry this sprite sheet.
Let's right click on it properties.
And let's see Hurting.
We have one, two, three, four, five.
So five sprites we have hurting.
So from here I guess basically let's scale in the bottom right.
We can see.
So let's scale for it now so we can see 12345.
Sorry I guess one two.
So this 123.
So this I guess this uh 12345.
So this five sprite.
So we're going to select all of them by holding down shift.
Let's drag it over to top of this anime GameObject in the hierarchy.
Let's go to assets in the top left then animations anime, animation, anime one animation.
And this will be anime one underscore heart.
So let's call this animation clip to anime one underscore heart and let's hit Enter or save.
And now if we choose that animation clip then play this button.
We can see it's playing the hurting animation clip over again and again.
And now let's create the death one.
So let's go over to project tab one more time.
And we have the date one over here.
So from here.
So we will select all of them by holding down shift.
And let's drag it over to this enemy game object.
Top of this enemy game object in the hierarchy.
And let's go to assets enemy animation enemy animations enemy one animation.
And this will be our death one.
So we can call simply enemy one underscore death.
So let's call this death.
And let's click on this save button or hit enter.
And let's move to animation tab.
And if we choose the death one we can see it's playing the death animation clip over again and again.
So we created all of the animation and we can take a look.
If we select our anime in the hierarchy, move over to animator tab.
We can see all of the animation we have.
We we created anime one underscore idle anime one underscore fire, anime heart, and anime death.
So we have all of this animation clip.
And if we move over to animation tab and we can we can see, uh, so some animation clip, I don't want
uh, to be loop the, uh, basically the heart one, heart one as well as the dead one.
I don't want this to animation to loop over again and again.
So we're gonna uncheck the loop time.
So as we have done inside this player animations clip.
So we will we will head over to project tab then assets folder then animation folder.
Basically we need to move over to that folder in which folder we place it.
All of the animation of this anime.
So we place it inside this anime animation folder, then anime one animation folder.
And we can see all of the animation clip.
We have the arrow fire, we have the arrow death and hurt as well as the idol.
So what we will do, we will choose the hard one and the death one.
By holding down control, we can choose or you can simply hold down shift as well.
But let's suppose you choose one to choose custom.
Then hold down Ctrl on your keyboard and select the and just click the mouse arrow.
So we will choose the date and the hard one.
Let's go over to Inspector and we can see Loop time.
So we're going to uncheck that.
Now these two animation clip not gonna be looped but the idol and the arrow fire will be loop.
And I'm going to scale it down a little bit.
So in the project tab in the bottom right you can see this scaler tool in order to zoom in or as zoom
in or zoom out.
So you can just do that.
So I hope you get the idea that how you can do it.
And let's make this anime as well a prefab.
So we are gonna have the copy of it.
So let's go over to assets then prefabs folder, let's select our anime in the hierarchy and then drag
it over to this prefabs folder in order to turn it into a prefab.
And now this is fine.
And we can simply press down Ctrl s on our keyboard in order to save our project.
Basically, we have done the same same thing as we have done with our player animation player animation.
So we created all of the animation clip of this anime.
So I hope you get the idea.
And you can create multiple enemies in this same way as we created this anime one.
So let's call this one enemy one instead of calling enemy.
So this will be the first enemy.
So that's why.
So what we can do, we can simply open up the prefab so we can head over to our project app assets and
then prefabs folder.
And let's double click on this enemy in order to open that up.
And let's go over to Inspector.
And let's call this one to something like enemy one.
And after doing it let's go back.
So let's click on this rename file.
And if we go back still the change is not been not happened inside this enemy GameObject in the hierarchy.
So we can just manually do it.
So let's select our enemy in the hierarchy.
Go over to Inspector and let's call this enemy one.
And we can just move over to overrides and then apply all.
If we change something around inside this enemy one game object, it's going to be saved into this enemy
game enemy one GameObject prefab as well.
And now I'm gonna press down Ctrl S on my keyboard in order to save my project.