• 2D
  • How to make two character animations work as one?

Hello,

I have a seemingly simple task that I have no idea how to approach. I searched through and through, to no avail.

I'm making my first two-player game with a friend. It involves characters that are co-dependent - One of them can climb the other one's shoulders and jump off. All animations are separated, except for when the shoulder ride is taking place. I want one foot and one hand of the upper character to "protrude" over the shoulder and head of the bottom one if players choose to enter this "dual-mode" (Like this: )

Does anyone know how to approach this? Thanks in advance for anyone who points me in the right direction.

Welcome to the forums @RastermanVector!

How are your animations setup? Are you using bone-based animation, frame-based, or something else? Also, what perspective does your game use? Top down, side-scrolling, etc.

If this was a 3D project, I would suggest using animation blend trees to handle this, perhaps with IK to handle the arms of the character boosting the other character. For 2D, I would look at trying to "fake it" when you can, perhaps by requiring the characters to be in certain positions or facing certain ways before transitioning, so that way you can better control the transitions.

Then, if the animations are separate the entire time, you can just have the position and rotation of the boosted character follow the other character.

If the animations are the same, I would start the transition animation and then hide the separate character once they are boosted, disabling the code and other stuff so it doesn't get in the way. Then when transitioning back to two separate characters, I would play the transition animation, move the hidden separate character into the needed position, make the separated character visible, and then enable the code and other stuff.

At least, that is how I would approach the problem based on what I know. Hopefully what I wrote above is of some help!

Hi @TwistedTwigleg !

Thanks for the extensive answer, I already see it helping out in more than one way in the future.

For this particular endeavor, the setup is a 2D sidescroller. The idea is to have a fast, jumpy character being able to climb onto a brute who's higher to reach his goal, so, the characters are of different sizes and animated differently.

Now, I'm still looking into what the best course of action regarding animation is, but I'm probably going to use DUIK for After Effects and it's rigging system to ease the process of creating all the necessary loops and actions. As far as I'm aware, there's no direct way to use my SVG animation in Godot (I'm really hoping this will be incorporated in one of the future verisons), so using a JSON exported by AE is out of the question.

This means I'm probably going to export a PNG sequence for each animation and use Godot's Sprites to wrap it all together. If you have any words of advice other than what you wrote, please share, but the fifth paragraph of your reply really makes sense and is applicable to my situation.

Thanks a lot, for help and for the warm welcome! I'm really looking forward to using the forum more often as we go on figuring out Godot.

Ivan

Have a node 2D parented to the Brute that you can use as a hook, animate it's location in the pickup/holding animation, then in game when the other character is picked up, if it's pivot point is in the middle and just below its feet, relative to the hook as it's temporary parent with it's location being 0, 0 it is effectively standing on top of the hook/brutes hands.

edit: note that the same pickup animation and hook could be used for picking up other objects in the game world as well.

@Megalomaniak thanks for the insight. I'm not sure It completely relates to what I'm trying to pull here - we're not looking for the Brute to hold the Runner (let's call them that), but for the Runner to be on Brute's shoulders.

Just to add some detail for better understanding (this thread might come in handy to someone trying to do a similar thing): We're triggering the "enter" animation when X positions of the two characters meet and then upping the Ypos of the Runner to be in the correct position relative to the Brute. There is an aiming mechanism involved for the throw.

The exit animation is actually the Brute reaching with his hands and throwing the Runner. I still have to figure out how to achieve this for it to look fluent. Animating the enter animation (climbing and sitting on shoulders) can be done by utilizing what @TwistedTwigleg advised - having the Runner going behind the Brute, hiding the individual Runner sprite and adding him temporarily to the Brute's animation. The throw is still something I have to figure out, I'm probably going to have to think of a similar trick, but in my head, this is still not working.

Btw, my inspiration came from Donkey Kong coop, but I'm looking to incorporate it in 2D (In DK, even the old ones, this was done in 3D). Although doing this in 3D is an option, it's something I'd rather not do because I'm not that versed.

Here's a quick sketch of mine so you can visualize what the "Merged" mode is supposed to look like in terms of composition.

Hmm, assuming the arms are separate child nodes all it might take is giving the body a sprite where in case of the other player having climbed on shoulders the brute has a alpha mask that makes part of the sprite transparent so the other ones legs show through. Or even switch the sprite for the brute outright in that case.

This way @TwistedTwigleg's solution should work?

If you have each limb as a separate node, then it shouldn't be too difficult to have separate animations for both characters and just change the Z-index of the limbs (in the animation) to make the transition. That said, from an ease of use point of view, having a simple already setup animation might be easier. Using an alpha mask like @Megalomaniak suggested is also not a bad idea, especially if you want to keep both objects separate for the entire time but do not have bone-based 2D animation (or do not want to mess with Z-indexing, which could be complicated depending on the animation).

As for throwing, I think you can just do the reverse of having the character get on the other.

If the brute and the runner are a single node/sprite when together, then what I would do is have a throwing animation where the brute starts to throw the runner off. Then, at a certain frame, remove the runner from the sprite animation and move the separated runner sprite at whatever position the runner would have been in the animation, re-enable the script, and then it should work.

For bone based animation, I think it would be a little trickier due to Z-index conflicts. I would suggest a similar approach to what I wrote above, but instead of making the sprite change, instead change the Z-index values of each limb to whatever is needed to make the runner work normally when the limbs are past the body of the brute.

I should mention though, almost everything I have written above is theoretical rather than solutions I've tested, so I have no idea if they would actually work in practice. That is what I might try though!