direction = PlayerAnimationNames.None;
this.stop();
}
- if(this.previousMove !== PlayerAnimationNames.None || direction !== PlayerAnimationNames.None){
- this.sharePosition(direction);
- }
- this.previousMove = direction;
- }
-
+
- private sharePosition(direction: string) {
- if (ConnexionInstance) {
- ConnexionInstance.sharePosition(this.x, this.y, direction);
- }
+ this.emit(hasMovedEventName, {direction, x: this.x, y: this.y});
}
+ //todo: put this method into the NonPlayer class instead
updatePosition(MessageUserPosition: MessageUserPositionInterface) {
playAnimation(this, MessageUserPosition.position.direction);
this.setX(MessageUserPosition.position.x);