There is an animated sprite with animationupdate
event handler:
sprite.on('animationupdate', (anim, frame) => onAnimationUpdateHandler(sprite, anim, frame));
How I can change current frame on started animation inside that event handler?
I found a setCurrentFrame method in Phaser Docs (Phaser 3 API Documentation - Class: Animation ), but I do not understand how to use it.
samme
April 28, 2021, 5:54pm
2
What are you trying to do overall?
Possible you want to use the startAt
argument in play()
instead.
I need to change frames order from “1-2-3-4-5-6”
to “1-2-3-4-3-4-3-4-5-6” (e.g.) in some cases.
New frames order can be different and depends on algorithm.
samme
April 29, 2021, 3:27pm
4
sprite.anims.setCurrentFrame(anim.getFrameAt(index));
Thanks!
Method getFrameAt
is private, but it’s nothing.