Download

Animating question for when a character is running and shooting. (2D-side scroller)

Hey everyone,

I finished working through the 3-part tutorial series by Alan Noon (seen here https://www.youtube.com/watch?v=cCl1DHhIYeY).

I’ve been trying for awhile now and I’ve been unable to trigger an animation for when the character is running and shooting. Running works. Shooting works. But now I need a way to tell if the character is doing both to trigger the third animation – he’ll hold out his weapon while running.

The two images show the portions of the blueprint which control movement as well as shooting. I’m guessing I should be running some sort of check up in the movement section to see if the player is triggering the shooting event, and then updating the animation accordingly, but I can’t figure out how/if this is actually what I should be doing.

Any help is appreciated.

If you create a variable called “isRunning” and another variable called “isShooting”, which are set to true when running or shooting, and back to false when stopped running or shooting, you can check to see if both of them are true with branch nodes - and then set your running/shooting animation.

Even better, if you set isRunning and isShooting you can use an “AND” node to combine them. If the result of the AND gate is false, you just apply the normal checks because one or the other is true (or both are false). If the AND gate is true, play the third anim.

Hey guys,

Thanks for the help. I got it working. All I really needed to do was add an isRunning variable to the end of the running function already set up. Then take that variable and plug it into a branch for the shooting function. I was just trying to making things overly complicated when all I needed to do was take what was already there call the variable isRunning.

b07cd0b33e8feae61d9886a65966fa3f410fbe6c.jpeg
Run-shoot04.jpg

On that compare float, off the unused pin (==), you’ll want to set isRunning false.

I actually found out what I had wasn’t working. For some reason it would work once, but after I started moving only the RunShoot animation would play, even if my character was just standing still and shooting. I ended up creating a new isRunning variable by just checking if the velocity of the character is greater than 0. It seems to be working fine now. Thanks for the help.