Welcome back, my fellow game developers.
In this video, as promised,
we've added a bit of brutality to the way our enemy dies.
So now when I shoot him with DO bullets, look what happens.
1, 2, and you can see the blood splashing from him.
Now even though he's a skeleton,
technically he doesn't have blood.
But let's use our imagination and figure something out.
Anyways, let's not waste any more time.
The challenge in this video will be a like,
let's say me versus you who can do the challenge faster.
So I need your full attention and concentration.
Let's not waste anymore time.
Let's get started.
Which is a new kind of challenge.
And who can do with faster?
Why?
Because you have all the tools necessary.
We're doing something that we've done a lot of times before.
So my goal right now is to see who can do it faster.
Can you do it faster than me?
And we're going to have a small cup petition before we start
to create a splatter sprites.
So the Animation create a serialized field of the death splatter, where should it be?
And finally, before we destroy the enemy,
we are going to instantiate this death splatter.
So I hope you're up to the challenge.
Let's not waste any more time and let's get started. Don't pause the video.
Let's go. Let's go. Okay, so first thing,
no pressure, no pressure.
It's not like you're going against the instructor.
Anyways, blood splatter, we are inside of this Brights.
I'm going to go here and we have already everything sliced up.
I'm going to add this file open up. There we go.
You can see it right here.
Let's go ahead and right-click create an empty game object.
I'm going to reset its position right here.
I'm going to go ahead into the animations, great animation.
This will be in the assets and animations.
Right-click.
There you go. Side of V, right-click.
Oh, no, So lot splashing.
After.
Enemy.
A very long name for an animation.
Now I'm going to choose all of the sprites,
go ahead and add them in here.
Let's run this and see how that looks.
Okay, That's a lot of lot.
So I'm going to choose all of that and maybe make the pixels per unit a bit more,
maybe 120 or 150.
Apply that.
Let's try this animation again.
Book. Oh, okay.
It is a bit smaller.
Let's make it ten seconds.
Okay.
Maybe I'll even keep it for 20.
Let's see. Okay, so I think 20 is good enough.
Let's go, let's go, let's go.
Next thing we're going to do is we're going into the NMI controller in here.
We'll get a reference to the blood splatter.
I'm going to go ahead and after the damage.
So serialized field, which is going to be the mature,
call it a game object as the death splatter.
Why does butter?
I'm not even sure.
I'll just keep it at the end because all the effects,
it's always better to add the effects at the end.
Save that.
What else should we do when we get destroyed right here?
Or, oh, I, well,
a huge mistake by me,
not in the player controller right here and the enemy, save that.
Oh, okay, so you now have a head-start over me because of my stupid mistakes.
No worries, we save that scroll down to the enemy.
Where does he died before he gets destroyed,
I'm going to instantiate the deaf splatter at the transform dot position.
So I hope you are well on your road because I'm
almost finished transform dot rotation and maybe you're just waiting for me and laughing.
So save that everything is good.
Go back in here, the game object,
this is the load splatters.
Save that.
And the enemy also,
we are going to prefer this,
so we'll go into the refunds. There we go.
Blood splattered, added and here go to the enemy.
He gets the death splatter removed from the hierarchy,
save that, run the game.
Should the enemy twice? He does.
And I can see the blood splatter, but oh,
I think we forgot to make sure that the sprite renderer is on the where should I add it?
Which, or I can add a sorting layer.
Let's see, let's think about this for a second.
I can add 0, so the enemies, Okay, great.
So for the enemy, save that.
And now when we shoot the enemy twice,
we should see the blood.
Okay, great. So, but as you can see,
we have it on loop.
So I'm going to go into the animations,
blood and remove the loop time,
save that, run the game again.
And we should have a very nice,
very nice splash of blood.
And there you go, disappears.
We need to make sure that there are a couple of inconveniences.
So at the end, we might want to go ahead and destroy this.
So to do that,
let us go into our scripts in here.
And we've already created some kind of script which was the impact effect destroyer.
We can, by the way, let's go ahead and go into the Prefabs,
choose the blood splatter.
We have this little lock in here,
so this is no longer part of the challenge.
This is something extra that will add.
I even forgot about the destruction of this.
And we can go ahead and add the impact effect, destroyer, destroyer.
So now I can access this right here and I can tell it that when we get to
the last frame and maybe we can even keep it
for maybe a couple of milliseconds right here,
so the blood is on the ground.
After we finish, we add this little fact,
remove the lock and the animation event.
What seems to be the problem here?
Some kind of key, it's opened up.
Okay, So we have the destroyed,
but for some reason the blood splashing after the enemy.
Hey, welcome back.
So there was a tiny problem when I added the event,
I had something different.
The problem was that if you don't have the blood splatter,
for example, in the hierarchy,
when you add an event,
it looks a bit weird.
Let me show you again.
So I chose the blood splatter and the animation choose the blood spatter.
So you can see there is no animation.
We first need to add it in here in the hierarchy and our scene.
Then we can go ahead and add
the little event that me just do this one more time. So there you go.
And about 50, I'm going to add this function right here.
I'm going to access the destroy,
save that, run the game.
Now, I kill the enemy with a couple of bullets.
The splatter happens book,
and then it gets removed by itself.
We no longer have it in our hierarchy.
So I hope you enjoy it.
I hope you did the challenge.
Maybe you didn't do it as fast as me.
You pause the video,
you tried a couple of things yourself.
It's a bit advanced.
Everything that we used,
we already know the instantiation.
The what is the effect that we created,
the animation, the transformed position,
all of that we've done,
maybe the only bit of challenge,
maybe you didn't know where you should have added this.
Maybe you added after the destroy.
I don't think that works if you've added it after you destroy so well done,
make sure to commit your changes, I hope you enjoyed.
And in the next video we are going to add some brutality to the way we hurt our enemy.
So currently when we shoot him,
he doesn't feel anything,
but we will make sure that he does.
And by the way, also,
we have the death animation that you can create for
the enemy and added to him when he dies,
some kind of trigger.
Maybe we'll do it later on.
If you don't want too late for my lazy behind,
you can go ahead and do it right now in between videos.
So I'll see you in the next one.