Skip to content

Commit 8b0ae6a

Browse files
author
Julien Poulton
committed
fix(sdk): Fixed SpriteAnimations not animating
1 parent b2a3277 commit 8b0ae6a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

engine/modules/entities/src/main/resources/view/entity-module/SpriteAnimation.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ export class SpriteAnimation extends TextureBasedEntity {
3838
const images = state.images.split(',')
3939

4040
if (state.animationProgress >= 0) {
41-
const animationIndex = Math.floor(images.length * state.animationProgress)
41+
const currentDate = frame.date + frame.frameDuration * progress
42+
const extrapolatedState = { ...state, date: currentDate }
43+
this.computeAnimationProgressTime(state, extrapolatedState)
44+
45+
const animationIndex = Math.floor(images.length * extrapolatedState.animationProgress)
4246
const image = state.loop ? images[animationIndex % images.length] : (images[animationIndex] || images[images.length - 1])
47+
4348
try {
4449
this.graphics.texture = PIXI.Texture.fromFrame(image)
4550
} catch (error) {

playground/misc/misc-3-release-notes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
The CodinGame SDK is regularly updated and improved. This document lets you know what changed in the latest releases.
44

5-
## NEXT RELEASE
5+
## Next Release
66

77
### 🐞 Bug fix
88

99
- Removed accidental console.log from app.js
10+
- Fixed `SpriteAnimation` that would sometimes not animate
1011

1112
## 3.10.0
1213

0 commit comments

Comments
 (0)