All right.
So we need some animation blueprints for our characters and for this top down project.
These are going to be relatively simple.
Let's get started with Ora's animation blueprint before we move on to the enemy.
Now here in the Ora folder, I'm going to make my animation blueprint.
Right click.
Animation, animation, blueprint.
And for this I'm going to choose src ora.
That's Ora's skeleton asset.
So we can create and I'll call this app ora.
Opening that up.
This will be fairly simple.
I'll have a single state machine.
So I'm going to right click type state machine, grab one of those.
I'll call this main states and before I hook it up to the output pose, I'm going to run it through
a slot.
So I'm going to choose default slot and hook that up.
As you should know, a slot is used for playing montages and we will be playing montages.
Now for main states, we want an idle walk run state, so I'm going to drag off of entry, add a state,
I'm going to call it idle walk, run.
And inside of this state I want a blend space.
Now if I click on asset browser, we'll see that our assets contain this idle walk run and it's a basic
blend space.
If I hold control and drag my mouse, I can see her walking and I can drag it all the way up and we
can see that she's running and there are even footstep sounds.
So this is great.
We're going to use this in AVP Aura.
I'm going to go ahead and just drag it on in and hook it up so we have an idle walk run, but we do
need the speed.
So we're going to go into the event graph and set up a couple of variables.
For one, I'm going to override Blueprint, initialize animation, and we're going to take that.
I'm going to drag it up to the top and we're going to try get pawn owner.
I'll bring that node up here and we'll go ahead and cast this to BP or a character.
We'll get that.
And I'm going to promote this to a variable drag off, promote a variable.
I'll call this BP or a character.
And from the Aura character, I'm going to get the movement component.
So character movement is what it's called, and we'll promote this to a variable as well.
I'll just leave it character movement.
I'll go ahead and take the space out of the name and hook that up.
So now we have the character movement component that we can access in Blueprint update animation.
Now, if we wanted a much more complicated animation blueprint, we could use Blueprint Threadsafe update
animation.
But this is a simple one, so we don't need to use Multithreading.
But we would use that instead of blueprint update animation for a much more complicated animation blueprint.
But here all I'm going to do is get the BP or a character I'm going to control left click, drag that
out right, click on it and convert to a validated get.
And if it's valid, then I'm assuming the character movement variable will be valid as well.
And from the character movement, I'm going to drag that out.
I'm going to get the velocity from it.
And from the velocity I would like the length x, y.
That's just the lateral speed for the character movement and I'm going to promote that to a variable.
I'm going to call it ground speed.
So we now have a ground speed variable and I'm going to drive my blend space with ground speed.
So we can compile and save that.
And we see aura in the nice idle pose.
That's great.
So I'm going to go back to BP Aura Character, select the mesh and we'll set the anim class to App Aura.
And she's idling.
Great.
So now we need one for the enemy.
But the thing is, we're going to have multiple enemies.
They're not all going to share the same skeletal mesh and skeleton.
So to make this more versatile and to prevent repeat code, our Enemies animation blueprint is going
to be a template animation blueprint.
So we're going to go back out to character.
And here in the character folder, I'm going to make a common animation blueprint template that we can
use for all of our enemy animation blueprints, and that'll save us some work.
So I can right click, go to animation, animation blueprint, and I can choose specific skeleton or
template.
I'm going to choose template and select Create.
And we now have our animation blueprint template that we can use for our enemy.
So I'm going to just call this app Enemy and we'll go ahead and open this up and we can put things here
that we want all of our enemy animation blueprints to have in common.
For one, we're going to need a state machine.
So I'll go ahead and add one.
Just like with aura we'll call this main states.
And just like with Aura, we'll run it through a slot.
We'll use default slot and our main states is going to want an idle walk run.
So we'll drag out, add a state, we'll call this idle walk, run.
And here in idle walk, run, we're not going to drag in any particular blend space.
We're going to right click and type blend space player and we're going to use blend space player.
And this is a generic node.
We're going to hook that up to the output animation pose.
So when we create a child animation blueprint derived from this template, all we have to do is select
the blend space player and we'll do that.
But we also need a variable to drive the blend space x axis.
That's going to be the speed.
So we'll go to the event graph and we'll do what we did for Aura.
We'll basically try get Pawn Owner that's going to be on Blueprint, initialize animation.
And for try get pawn owner we're going to just simply cast to aura enemy.
That's the C plus plus class from Aura Enemy.
We're going to get character movement.
And we're going to promote that to a variable.
And we'll hook this up here.
Now, if we decide later that we need a variable for the enemy, we'll promote it then.
But for now, we're just going to use the character movement and get that ground speed.
So I'm going to control, click and drag out, get the character movement.
I'm going to make this a validated get.
And if that's valid, we'll get the velocity.
We'll get length x y.
And we'll promote this to a variable called groundspeed.
We'll set that.
And we can use ground speed to drive the x axis on our blend space player and compile and save that.
And now we need to make a child based on this animation blueprint template for our goblin sphere.
So I'm going to go into Goblin Sphere, right click, go to animation, animation Blueprint, and this
time choose the parent class enemy and I can choose a specific skeleton.
We'll choose SRC Goblin and click Create and I'll call this app Goblin.
Underscore spear.
Well, open that and all we need to do here is go to the asset override panel.
If you don't see it, go to window and make sure asset override is checked there and we'll expand the
dropdown for anim graph main states Idle walk, Run.
Here's the blend space player and we'll see that we can set this to one of our blend spaces and we have
some blend spaces in the assets for this project.
We have one for the Slingshot Goblin and one for the Spear Goblin.
So we're going to select Goblin, Spear, Idle Run and we'll use that compile.
And we see that our goblins now idling here in the preview window.
And if we go to Goblin Spear.
And we select the mesh.
We can choose a goblin spear and our goblin is idling.
Perfect.
Now, what's that goblin slingshot we just saw?
If we look at it in the asset browser, here's that goblin slingshot.
I can double click on it.
And this is what it looks like.
So you'll see that it's animated a little bit differently to accommodate for a slingshot.
That means we must have a slingshot weapon asset as well.
If I go to Assets and Enemies Goblin, you'll see there's a slingshot folder.
And right here in the centered folder, we have an xxm slingshot.
Here's what it looks like.
And the pouch even has a bone that we can move and you'll see that the slingshot actually stretches.
Pretty awesome.
So that means we're going to have a different type of goblin enemy.
That's why we call this one goblin spear.
We're going to want a goblin slingshot as well, aren't we?
So why don't we do that?
And that's actually going to be your quest.
So for this quest, you're going to make the Slingshot goblin, call it Goblin Slingshot based on or
enemy and find the slingshot asset that's going to be the weapon for the enemy.
Don't worry about trying to make that pouch stick to the hand.
We'll do that later.
For now, just make the basic goblin slingshot enemy blueprint and create and assign its animation blueprint,
just like we did with the spear enemy.
Go ahead and pause the video and conquer this quest now.
Okay, So for this quest, we need another animation blueprint.
I'm going to go into my content Blueprints character folder, and we'll make a new folder for the Goblin
Slingshot.
So we're going to right click new folder.
We'll call this one goblin underscore Slingshot.
And we'll make a new blueprint here.
So, Blueprint class, we're going to choose Ora Enemy.
Select.
We'll call this BP goblin underscore Slingshot.
We'll open that up and we just need to set that mesh.
It's going to be the same mesh as the Goblin Spear.
So I'm going to choose Goblin here.
We're going to rotate it by 90 degrees.
We'll drop it on down and make the capsule a bit smaller.
Now, this is the same size, so I could just go to BP, Goblin Spear, take that capsule, see the
capsule, half height and radius.
That's about 51 and 28.
So I'll put in 51 here and a 28 here.
So that looks about right.
We'll raise the mesh a bit.
Perfect.
Now we know that this mesh already has that hand socket.
We just need to set the weapon.
So I'm going to choose the weapon.
I'm going to search for Slingshot.
And there it is.
We have the slingshot there.
Okay, great.
And right next to the blueprint, I'm going to make the animation blueprint.
Going to animation.
Animation Blueprint.
Choose the parent class that's going to be an enemy.
Our animation blueprint template.
And here's the goblin as our skeleton.
We're going to click Create, and I'll call this app underscore Goblin, underscore Slingshot.
And this is going to be easy.
All we have to do is open it up, go to asset override and toil down all the dropdowns until we get
to the blend space player.
And we can choose between Goblin, Slingshot, Idle run, compile that and now we have our animation
blueprint.
We can go back to our goblin slingshot, select the mesh and choose our anim class, which is a goblin
slingshot now.
And it's looking great now.
The pouch is not in the hand.
We would like that to be the case.
We'll do that later.
Don't worry too much about that.
All that we care about now is that we have our goblin and we saw that we didn't have to go into the
animation blueprint and set all the variables or anything like that because we're using the animation
blueprint template and we can share that for our enemies.
All we need to do is swap out the meshes and change whatever animation assets we're using here in the
animation blueprint.
And things are easy.
All right, so now that we have our two different types of goblins, we can save all.
And we're now ready to start handling player input, setting up enhanced input for our character, and
we'll do all that good stuff next.
I'll see you soon.