mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Fix issues with Sprite animation frame updates (#6493)
This commit is contained in:
@@ -347,6 +347,7 @@ namespace gdjs {
|
||||
|
||||
// Make sure to delete already existing animations which are not used anymore.
|
||||
this._animationFrame = null;
|
||||
this.invalidateFrame();
|
||||
}
|
||||
|
||||
updateFromObjectData(
|
||||
@@ -476,16 +477,17 @@ namespace gdjs {
|
||||
return this._animations[this._currentAnimation].name;
|
||||
}
|
||||
|
||||
setAnimationName(newAnimationName: string): void {
|
||||
setAnimationName(newAnimationName: string): boolean {
|
||||
if (!newAnimationName) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < this._animations.length; ++i) {
|
||||
if (this._animations[i].name === newAnimationName) {
|
||||
this.setAnimationIndex(i);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
hasAnimationEnded(): boolean {
|
||||
|
@@ -237,7 +237,15 @@ namespace gdjs {
|
||||
}
|
||||
|
||||
setAnimationName(newAnimationName: string): void {
|
||||
this._animator.setAnimationName(newAnimationName);
|
||||
const hasAnimationChanged = this._animator.setAnimationName(
|
||||
newAnimationName
|
||||
);
|
||||
if (hasAnimationChanged) {
|
||||
//TODO: This may be unnecessary.
|
||||
this._renderer.update();
|
||||
this._animationFrameDirty = true;
|
||||
this.invalidateHitboxes();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user