I have an animated sprite of a rotating coin. The coin can be gold or silver and there is a separate animation for each color.
User action can cause the color to change. When this happens, I replace the animation of the sprite as well as restore the correct frame number so that the color transition would look seamless:
var oldFrame = $CoinSprite.frame
if $CoinSprite.animation == "Gold":
$CoinSprite.animation = "Silver"
$CoinSprite.animation = "Gold"
$CoinSprite.frame = oldFrame
The problem is that while I can restore the frame, it goes back to the beginning of the frame. This little lost time cause the animation to loose synch with the other coins.
Is there a way to change the animation while retaining the "position" inside the frame? Is there a way to sync all coin instances?