Changing the "Point" notion to add a notion of "moving" in addition to the notion of direction.

Also, refactoring JOIN_ROOM event to add complete position.
This commit is contained in:
David Négrier 2020-05-22 22:59:43 +02:00
parent f44a44c109
commit ab798b1c09
9 changed files with 101 additions and 88 deletions

View file

@ -14,7 +14,6 @@ export enum PlayerAnimationNames {
WalkLeft = 'left',
WalkUp = 'up',
WalkRight = 'right',
None = 'none',
}
export const getPlayerAnimations = (name: string = Textures.Player): AnimationData[] => {
@ -48,11 +47,3 @@ export const getPlayerAnimations = (name: string = Textures.Player): AnimationDa
repeat: -1
}];
};
export const playAnimation = (Player : Phaser.GameObjects.Sprite, direction : string) => {
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.stop();
}
}