BEAT EM UP GAME - How to achieve this look with the animation?

In a typical beat em up game, if the player presses left or right, they instantly turn left or right. That part I did figure out using the following code, Instantly turn left and right (Sidescroller template) posted by BizaaroGrodd | blueprintUE | PasteBin For Unreal Engine.

And if the player presses down, they just strafe down while facing left or right and the animation plays of their legs moving.

But, there is more, most beat em ups feature an animation when the player presses up of essentially a 45 degree angle, so that you see the players (and also enemies) turned backs when moving up. It would be like creating a third person template, and dialing the camera view in to look like most beat em ups, then pressing at a 45 degree angle to the up and left, or up and right. How to achieve this? So that when the player presses up, or up left, or up right, we are shown the player at a 45 degree angle look whilst they strafe up or down? Thank you.

Bump

If you use the standard third person template, you want to change the character to make the camera “boom” be expressed in WORLD space, not RELATIVE space. That way, the camera won’t turn when the character turns.

Next, you need the actual Character to take the appropriate orientation based on control input. There’s a few ways of doing this; either you can turn off the flags that let the character take its orientation from the controller, and directly set the orientation of the character, OR you can lean into the controller orientation, and update the controller orientation based on inputs. Which one you do might depend most on where you decode user inputs; if you decode straight in the character, use the former; if you use the player controller, use the latter.

1 Like

My solution for that was to make a camera actor blueprint. It is just a camera and some collision walls that block the player from going too far up or down or left or right. The camera moves in the Y axis and only to the right or Y plus. Then set view target with blend in the level BP to use this new camera. This way the camera governs the movement of the game and can be made to stop once the player walks up to a group of enemies and not move again until all enemies have been defeated.

But it would be interesting to see it done from a camera that was parented to the player. Someone in the forum once explained to me a way I could do it using some kind of child actor system but I never got it to work.

That is what I’m doing to keep the players looking either left or right all the time. I set the rotation in Z to -90 or 90 accordingly.

Ok, will consider that. Thanks for your input.

The following code works, but only if the player is moving up or down (in this BEU case X- and X+). But not if the player is moving forward and UP or backward and UP.

Hopefully someone out there can show me what to add here so that it can also be achieved while moving left UP or right UP.

Right now, this behavior is like on the TMNT arcade game by Konami, the player must be constantly holding up else it snapped back in place instantly, whereas with Golden Axe by Sega for example, the player stayed in that 45 degree UP state unless the player attacked or moved left or right or down. And speaking of that…this 45 degree angle thing also has a caveat, before the player attacks and maybe even jumps, the player’s capsule will have to be snapped back to -90 or 90 degrees to achieve the classic beat em up left and right attacking.

1 Like

Easiest way would probably be to use orient rotation to movement on the player char, then while attack anims are playing, rinterp back to facing left or right. Or just let players attack at an angle to spice things up.

If this would be a 2D char, then i would set it up as a 4 directional char, where the left/right and down or down-left/down-right use the same flipbooks/animations. Then only the upward movements get your diagonal animations.

I guess, for checking, i would use 2 enums (bools are fine too, but i find enums easier to read ^.^), one with the two entries “left” and “right” (for saving, if your current or last direction was in any shape way or form into the left or right direction), and one with “upward” and “sideways” (or “horizontal”); and maybe “downward”, if you ever want add a diagonal downward animation.

Then, whenever you move upward, sideways or downward, you check, what you have currently in the left-right enum, and play the fitting animation.
The left-right movement would have a “Compare” node, and only set the left-right enum to left or right, if there is an input value greater or smaller than Zero (or maybe even 0.1 or 0.2 to have a deadzone for your stick), for your left-right axis (Y).
With that you avoid your char snapping back, if you let your stick go and it snaps into it´s zero position.

For your upward movement, you could use a compare node, that checks, if your vertical value is greater than your 0.5 on your up axis (X+) to get your 45 degree angle, and only then switch from sideways to upward, and if its lower, then it switches back to sideways.
Downward wouldn´t matter, because sideways and downward use the same animation, but if you want it, then you just check for -0.5 or less, to switch to downward.

1 Like

Ok thanks for the reply and sharing your ideas. I will keep this in mind. For the time being I have decided not to worry about this for now and just focus on core gameplay and come back to it later.