qwaser

Let's say i have a walk cycle animation (to the right) and turn animation (right to left).
In game, i play walk animation. When user wants to change the direction i play turn animation and what should i do next?

1) I can't mix turn animation with walk animation scaled along X by -1 (at least didn't see anything related to this in the API).
2) Play walk animation and flip the skeleton right after turn animation ends without mixing, but some jerk and abrupt movements may appear.
3) Make several addition animations for each direction (like walk to the right, walk to the left) in Spine editor and mix turn animation with corresponding animation. But i don't think it's proper way because of overhead and looks like waste of time.

So how to do it smoothly? Maybe there're some code examples on how to do it?
qwaser
  • Postovi: 1

Nate

Sorry for the late response.

I suppose it's up to you how to handle turns. That is a movement that usually needs to be instant, else your controls will feel sluggish to the user. That's similar to going from idle to walk/run or back to idle -- it can't take too long because the user expects their character to react to their inputs quickly.

For turnaround, most games do it instantly. You could do that, then play an animation that is the turnaround. In some Super Mario games, Nintendo does this if Mario is running quickly, he faces the other way instantly but has a sliding animation. They also have a little puff VFX at his feet, IIRC.

Turnaround is likely to be somewhat of a jerky movement, especially if your character sticks out farther on one side. You could flip your skeleton instantly and play your turnaround, but have your turnaround animation start flipped. That way your character is facing the right direction as far as your controls and game logic are concerned, but the visual from the turnaround animation makes it take some time. I would still only use a couple frames to complete the turnaround animation.

Regarding your #1, I guess you are looking for Skeleton scaleX.
Avatar
Nate

Nate
  • Postovi: 12131


Natrag na Runtimes