Merge pull request #80 from thecodingmachine/display_groups

Fixing "none" animation does not exist log
This commit is contained in:
David Négrier 2020-05-08 00:33:41 +02:00 committed by GitHub
commit ddbd4f4c06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,9 +50,10 @@ export const getPlayerAnimations = (name: string = Textures.Player): AnimationDa
}; };
export const playAnimation = (Player : Phaser.GameObjects.Sprite, direction : string) => { export const playAnimation = (Player : Phaser.GameObjects.Sprite, direction : string) => {
if (!Player.anims.currentAnim || Player.anims.currentAnim.key !== direction) { if (direction !== PlayerAnimationNames.None && (!Player.anims.currentAnim || Player.anims.currentAnim.key !== direction)) {
Player.anims.play(direction); Player.anims.play(direction);
} else if (direction === PlayerAnimationNames.None && Player.anims.currentAnim) { } else if (direction === PlayerAnimationNames.None && Player.anims.currentAnim) {
Player.anims.currentAnim.destroy(); //Player.anims.currentAnim.destroy();
Player.anims.stop();
} }
} }