2d sprites "flip in 3d" animation in a 2d game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By indruckbalazs


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:

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?

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 flip_x and flip_y properties.

Death of Shadows | 2021-01-12 23:24

:bust_in_silhouette: Reply From: ejricketts

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: Interpolation — Godot Engine (stable) documentation in English

Thank you! :slight_smile:

indruckbalazs | 2021-01-13 18:37

No problem! :slight_smile:

ejricketts | 2021-01-13 22:23