Merge pull request #140 from thecodingmachine/fix-animation

Fix animation player
This commit is contained in:
grégoire parant 2020-06-01 13:49:04 +02:00 committed by GitHub
commit 6f646745c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,13 +157,13 @@ export class Player extends PlayableCaracter implements CurrentGamerInterface, G
private playAnimation(direction : string, moving: boolean): void { private playAnimation(direction : string, moving: boolean): void {
if (moving && (!this.anims.currentAnim || this.anims.currentAnim.key !== direction)) { if (moving && (!this.anims.currentAnim || this.anims.currentAnim.key !== direction)) {
this.anims.play(this.PlayerTexture+'-'+direction); this.play(this.PlayerTexture+'-'+direction, true);
} else if (!moving) { } else if (!moving) {
/*if (this.anims.currentAnim) { /*if (this.anims.currentAnim) {
this.anims.stop(); this.anims.stop();
}*/ }*/
this.anims.play(this.PlayerTexture+'-'+direction); this.play(this.PlayerTexture+'-'+direction, true);
this.anims.stop(); this.stop();
} }
} }
} }