0 votes

Hello!

I have a question about 2d sprites flipping animation and I hope someone can help me.

So basically I have 2d sprites in a 2d game and when the player character changes direction I want it to have a nice flipping animation as if it would rotate around its Y axis "in 3d".

Here are 2 example videos I saw on youtube:

https://www.youtube.com/watch?v=RbwFaoIavCY&feature=emb_logo

https://www.youtube.com/watch?v=DVRoCxwnzTw

Is there any standard way to achieve this easily in Godot? As far as I know Godot has "true 2d", not "fake 2d" (2d in 3d, e.g. we don't have 3 axes).

The only thing I can think about is to scale the sprites on the X axis in some key frames in the animation player. Is there a better way than this?

Godot version 3.2.3
in Engine by (17 points)

Do you mean that the sprite is slowly rotating around the Y axis, or that it's flipping instantly? If it's a slow change, I think the only thing to do is to keyframe the scale like you said. Otherwise, the Sprite node has flipx and flipy properties.

1 Answer

0 votes
Best answer

The best way would be to interpolate your scale values from 1 to -1 or vice versa (flip effect). Here's the page to interpolation: https://docs.godotengine.org/en/stable/tutorials/math/interpolation.html

by (140 points)
selected by

Thank you! :)

No problem! :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.