I think there is one more issue with spritesheets.
Animations are missing the last one frame from array:
Video: https://imgur.com/FTmg79f
When I double the last frame to:
Then it works
I think there is one more issue with spritesheets.
Animations are missing the last one frame from array:
Video: https://imgur.com/FTmg79f
When I double the last frame to:
Then it works
Thank you, noted
It's not really a bug but a behavior of the animations.
When it reaches the last frame, it plays, but since the animation is finished, it stops immediately.
The solution is simply to set (in your case)
{ time : 210 }
to indicate the last time at the end of the animation. This time is in fact the final duration of the animation.
Yes, I have already added this to my spritesheet preset method:
# ...
array.push({ time: framesWidth * duration })
#...
Result:
const anim = (direction: Direction, framesWidth: number, duration: number = 5) => {
const array: any = []
for (let i = 0; i < framesWidth; i++) {
array.push({ time: i * duration, frameX: i, frameY: frameY(direction) })
}
array.push({ time: framesWidth * duration })
return array
}