Fix play anim
This commit is contained in:
parent
25895e51f7
commit
9d83ba22d5
@ -49,11 +49,7 @@ export const getPlayerAnimations = (PlayerValue : string): AnimationData[] => {
|
|||||||
|
|
||||||
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 (!Player.anims.currentAnim || Player.anims.currentAnim.key !== direction) {
|
||||||
if (direction !== PlayerAnimationNames.None) {
|
Player.anims.play(direction);
|
||||||
Player.anims.play(direction);
|
|
||||||
} else if (Player.anims.isPlaying) {
|
|
||||||
Player.anims.stop();
|
|
||||||
}
|
|
||||||
} else if (direction === PlayerAnimationNames.None && Player.anims.currentAnim) {
|
} else if (direction === PlayerAnimationNames.None && Player.anims.currentAnim) {
|
||||||
Player.anims.currentAnim.destroy();
|
Player.anims.currentAnim.destroy();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user