Let's create anime too.
So for that we will move over to project tab and then assets folder and then sprites folder.
But before we do it, let's disable our Anime -- GameObject first.
So we will select our anime one in the hierarchy.
Then go over to Inspector and uncheck.
Basically you disabling that.
Or you can simply select your anime and then press down delete in order to delete.
But before you delete, make sure you just go to overwrites and then just click on this apply on Apply
All if you change it, anything uh anything like that.
So you need to do it.
So let's uh so for that I'm going to head over to my project.
Have one more time than assets and then sprites folder.
Then I will head over to my anime folder.
To folder I have the Ninja right over here.
Basically this is our anime two.
So I'm going to select all of the sprite by holding down.
Shift that and then go over to Inspector and fix the sprite mode to.
We're going to choose multiple and pixel per unit.
We're going to choose something around 16 and then a filter mode.
We will choose Point of filter to get rid of blurry, and then click on this apply button in the bottom
right section.
So let's find the ideal one.
So we will select the ideal sprite.
So uh not the ideal.
Uh basically we're gonna select the work one.
Uh, since we basically want this enemy to patrol around our ground, and once our player game object
gets in attack range, then that enemy two game object just gonna attack on our player.
So let's do that.
So I'm going to select the work one.
So let's select that sprite sheet.
Let's go over to Inspector.
Let's click on this sprite editor.
So we need to slice it individually.
So as you can notice we have it.
So what we will do we will slice individually or grid by cell count.
So in the top left let's click on slice.
Let's select automatic to read by cell count.
And let's count how many columns and rows we have.
So we can see three, six, six, nine, ten columns.
So we're going to put ten columns and one row.
Let's click on the slice button and then click on this apply button.
And if we select our game view.
And let's move over to that sprite sheet.
And let's click on this arrow in order to see the individual.
So I'm going to select this one.
Let's drag it over to the scene view or into this hierarchy.
So I want this anime a little bit bigger.
So I'm going to select that sprite sheet.
Let's go over to Inspector.
And let's make this pixel per unit a even less number in order to make this sprite larger.
So we're going to do it something around 12.
And let's scroll down and we're going to click on this apply button.
And as soon as we click on that apply button by now we can see this is seems fine.
And make sure you do the same thing with all of this sprite.
So we will all select all of this sprite by holding down shift.
Let's go over to Inspector Pixel per unit.
We're going to make it 12.
And then scroll down and click on this overwrite for windows Mac Linux and choose this Mac size to something
around 16 384.
And then click on this apply button.
And once you're done, you you can skip this part, which is overwrite.
It doesn't need to be, so you can just leave that.
So let's rename this to something like anime two.
So let's call this one anime anime two.
Let's call this one anime two.
And we need to add some components to this anime two game object.
But before we do, we want to flip this anime to the left side.
To do so, let's go over to Inspector then sprite Renderer component and let's check this x one or horizontal
if we want to flip.
So that's why we need to check this x.
Firstly move over to Spriterenderer component and then check it.
Check that.
So it's gonna flip to the left direction.
And now let's add some components to this enemy two GameObject.
So the first thing I'm gonna add a rigid body 2D.
So let's click on this add component.
And we're gonna add rigid body 2D.
So let's attach that and gravity scale.
We're gonna choose three collision detection.
We're gonna choose continuous interpolate to interpolate to making out smooth.
And we're gonna freeze the rotation about z axis.
And I'm gonna scale up the gravity a little bit, something like five.
And also I want the mass of this animated game object a little bit heavy.
So I'm going to make it something around five.
And after doing that let's add one more component which will be a Collider 2D, Collider 2D.
So it's gonna detect collision.
So it's gonna detect collision and it's gonna fall down on top of this ground.
So it's not gonna just pass through this ground.
So let's click on this add component and we're gonna add a box Collider 2D and attach that.
And let's click on this Edit Collider.
And we're gonna edit the collider as the size of our animator GameObject as you can see.
So let's make it size something like this much.
And this seems pretty much fine.
So just adjust.
Just adjust the sprite as the size of your box Collider 2D.
So you need to make it something like that.
So as you can see now this is fine.
And we're gonna assign this enemy to as a enemy tag.
So we will go over to Inspector and Tag.
As you can see it says untagged.
So let's click there.
And we don't have any enemy tag yet so let's create that.
So I want to assign this enemy to as enemy tag.
To do so we will select our enemy to.
Let's go over to Inspector and let's click on this untag a and then click on this add tag.
And let's click on this plus icon.
So we're going to create a new tag.
And let's call this tag to something like sorry let's click let's call this one anime.
And let's click on the save button.
And we will select our anime two.
And let's assign with the tag which we recently created.
And we're going to assign this anime as a anime layer.
Basically this anime two.
So we will go to layer Add default it, set it to default.
So we're going to choose our anime.
So now we assign it this anime to anime two as well as anime layer.
And we're going to do the same thing.
Basically we need to assign our first anime one as anime tag, so we will choose our anime one in the
hierarchy, which we disable it, or you can simply move over to your project tab assets and then prefabs
folder, and you can find your anime one there.
Then select that, select that, then go over to Inspector and Tag.
As you can see it says on tag.
So we're going to assign with enemy.
Now we assign it this enemy one as well as this enemy to as enemy attack.
As you can notice in Inspector.
And now let's create the animation of this enemy two game object.
We.
So we're gonna create some animation.
So the first animation will be the working one.
Second animation will be the attack.
Something like that.
Third animation just gonna be the third one.
And the fourth animation will be you can simply say the animation clip.
So let's create those.
To do so I'm gonna head over to my project tab assets and then as sprites folder anime folder and then
E2 folder.
And let's select the sprite sheet which is work one.
So we're going to select this.
And let's click on this arrow in order to see individual sprite.
So we will select all of these individual sprite by holding down shift.
And then drag it over to this animator GameObject in the hierarchy.
Top of this animator GameObject in the hierarchy.
In order to make the animation right away and now we need to place the animation where we want to place
it.
So we will go to assets in the top left and assets.
We created this animation folder as you can notice.
So we will open that up by double clicking on it.
And let's we also created a sub folder which is enemy underscore animation.
So we're going to open that up as well by double clicking on it.
And we're going to create a new folder for this enemy two animation for this enemy two game object.
So let's right click then new a new folder.
And let's call this folder to something like enemy to underscore animation.
So let's call it enemy to underscore animation.
And let's open up this folder by double clicking on it.
So just wait and double clicking on it.
And now we have to we have to name the animation what we want to name it.
So since this is just going to be the work one, so we're going to call this one something like anime
two underscore work or petrol.
Let's call it petrol.
Let's simply call it work.
Instead of calling it petrol.
You can call that one petrol as well.
It's basically after you.
And now we're going to click on the save button in order to save it.
Uh, the animation.
And if we select our animator game object and then move over to animation tab and then click on this
play button, we can see by now anime two just playing this, playing this working animation clip over
again and again.
So if I just go ahead and hit this play button in the top, you will see as soon as our game.
Just gonna start this anime to game object.
Just gonna play a anime to work animation clip right away, over again and again, because we just created
that animation and we also need to create another other animation, which will be the you can say attack
heart and the death.
So let's do that.
So let's get out of play mode.
Basically we're going to do the same thing as we have done with our first anime.
So we will approach the same thing.
So let's head over to this project tab.
And now let's find our attack one.
So we're going to find the attack one.
So we have that that we have attack over here.
So let's select that Spritesheet.
Let's go over to Inspector.
Let's click on this open Sprite editor.
So we can see we have many as sprites.
So we need to split individually.
So before we do it let's count.
So 488 12 uh 1212 1314 1516 1718 1920.
So we have 20 columns.
So we're going to select automatic to create by cell count.
So let's put 20 columns and one row.
And then let's click on the slice button and then click on this apply button.
And I'm going to select my game view once again.
And let's go to that spreadsheet.
And then click on this arrow to see individual.
And we will select all of these individual sprite by holding down shift.
And let's drag it over to over to top of this animator GameObject in the hierarchy.
In order to make it a, make the animation, uh, in a faster way.
So we will go to assets animation, anime animations folder, animator animation folder, and we have
to name this animation.
So I'm going to call this animation clip something like animator.
So this will be the attack one.
So we can simply call this one animator underscore attack.
And let's click hit enter in order to save the animation.
And if we select our animator GameObject in the hierarchy, then move over to animation tab and then
click over here.
And then choose this attack one and then click on this play button.
We can see by now the enemy to attack animation just playing over again and again.
So let's create another animation.
So let's create the heart one as well as the that one.
So let's do that.
So we will head over to our project app assets and then sprites folder to folder.
And let's select the heart one uh heart one.
We have it over here.
So let's select that.
Let's click on this open sprite editor.
Let's select automatic to create pixel count.
So we have four columns.
So we're going to put four columns and one row.
Let's click on slice Apply.
And let's select that and let's drag it over to this Animator Game object.
Top of this animator GameObject in the hierarchy let's go to Assets Animation Animate Animation, Animator
Animation.
And let's call this animation clip to something like anime to underscore heart.
So let's call it animator underscore heart.
And now let's create the that one.
So we have the that one over here.
So let's select that.
Let's click on this open sprite editor and let's select uh we're gonna slice individually.
Basically we will slice from this automatic to grid by cell count.
And let's count how many columns and rows we have.
So we have one row.
And we need to count the columns.
So we have four uh 812 I guess 12 1315.
We need to count count perfectly.
So we have five, five, six, seven, eight and nine, 1011, 12, 13, 14.
So we need to put 14 columns and one row.
And then let's click on slice and then apply.
And now this is fine.
And let's select the game view once again.
And let's select all of these individual sprites, and let's drag it over to this top of this animator
GameObject in the hierarchy.
So let's go to Assets Animation Animate Animations Animator animation folder, and let's call this animation
clip to something like animate to underscore the death one.
And let's click on this save button.
And now if I select my animator GameObject and then move over to animation tab and then choose this
animation clip and then click on this play button.
We can see it's playing the animation clip perfectly.
So we have all of the animation that we need and we can check it.
So if I select my animator GameObject in the hierarchy, then move over to animator tab.
As you can notice, we have the attack.
We have the heart as well as the death animation clip.
So some animation clip I don't want to loop at all.
Uh, something like this.
Death animation and the heart one.
So we don't want those animation clip to be low.
below.
So what we will do for that?
We basically need to move over to that folder in which folder we just placed all of the animation of
this anime to game object.
So we need to move over to that folder and we need to find those clips.
So let's do that.
So for it we will head over to our project app, then assets folder and then animation folder, then
anime animations folder, then anime to underscore animation folder.
And now we can see all of the animation clip over here of this anime to game object.
So we have the attack one.
We have the that one, we have the heart one as well as the work one.
So we're gonna choose the heart and this death one by holding down shift.
Or you can simply hold down Ctrl as well by selecting a custom custom by basically if you want to select
custom then you can just do that basically holding down control and then go over to Inspector Loop.
Time we can see checked, so I'm gonna uncheck it since I don't want this animation clip to be low.
So now that fine.
And we need to create a script in order to make this anime move.
But before we move, I'm gonna select my animator in the hierarchy.
Let's go over to animation tab, and I'm going to choose the default one which is the wok.
So now this seems pretty much fine.
So let's create a script in order to move this script.
But before we do, if I just go ahead and then click on this play button in the top as soon as our game.
Just gonna start this anime two game object, just gonna play the wok animation clip over again and
again, since that animation clip is the default one.
So that is the reason.
And if you want to set any other animation clip as default, then you can just right click on it and
then click on this set set as layer default state.
And that state just gonna be the default one since I don't want so I want with the Walkman.
So I'm going to right click on it one more time and let's click on this set as layer default state.
So this is working fine.
And we need to make animation between these animations clip.
But before we do let's create the script first.
So let's get out of play mode.
And we can simply select our animator GameObject in the hierarchy.
Then go over to Inspector.
Then click on this add component.
In the bottom you can see New script.
So just click there and you can name the script whatever you want something you can name it to something
like animator.
And then after select uh basically naming the script, you can just click on this create an add button
in the bottom, and it's going to create the script right away.
And the script just going to attach, uh, to this animator game object.
Uh, right away.
Uh, so I already created a script.
Or if you want to create the script in a different way, we do know that we need to move over to our
project app, then this assets folder, then script folder.
We can right click there, then create and create.
Then go over to scripting and then click on this Monobehaviour script.
And you can name the script what you want to call that script.
Something like you can name it to some something like anime two.
It's totally up to you what you want to name it.
I already created that anime two script right over here, as you can notice.
So what we need to do now, we need to attach this script to our this anime two GameObject in order
to move this anime to game object.
So I'm going to select my anime two GameObject in the hierarchy, and let's select that script and then
drag it over to this Add Component section.
Or you can simply click on this add component, and you can find the script by typing name of the script.
And then click and then attach it.
So we need to find the script by typing name of the script, which is anime two.
And we can just select that and we can just click.
We can just hit enter in order to attach that.
I'm not gonna do it because I already done it, as you can notice right over here.
So I hope you get the idea that how you can make the animation clip, basically how you can set up the
anime to game object.
And now we're going to make this anime to game object as well a prefab.
So we will have the copy.
And if we just somehow lose this anime to game object so we can just directly store it, or else we
need to start over.
So that is the thing.
So let's make this anime two game object a prefab.
So we will select our anime game object in the hierarchy, and let's drag it over to this prefabs folder
in our project app inside this assets folder.
Now we turn it into a prefab.
It just turn out blue.
Basically means we just made it prefab.
Now we have the copy of it, and I'm going to press down Ctrl s on my keyboard in order to save my project.