From 05fbcad2523b433480ad9e27851087183f4af5d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20N=C3=A9grier?= Date: Thu, 7 May 2020 23:33:21 +0200 Subject: [PATCH] Fixing "none" animation does not exist log --- front/src/Phaser/Player/Animation.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Player/Animation.ts b/front/src/Phaser/Player/Animation.ts index 46c0515..1c555ad 100644 --- a/front/src/Phaser/Player/Animation.ts +++ b/front/src/Phaser/Player/Animation.ts @@ -50,9 +50,10 @@ export const getPlayerAnimations = (name: string = Textures.Player): AnimationDa }; 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); } else if (direction === PlayerAnimationNames.None && Player.anims.currentAnim) { - Player.anims.currentAnim.destroy(); + //Player.anims.currentAnim.destroy(); + Player.anims.stop(); } } -- 2.25.1