diff --git a/packages/core/src/traits/controllable.js b/packages/core/src/traits/controllable.js index 08b13a3..1a18b89 100644 --- a/packages/core/src/traits/controllable.js +++ b/packages/core/src/traits/controllable.js @@ -10,7 +10,7 @@ import { const decorate = compose( EventEmitter, - Vector.Mixin('movement', 'x', 'y', { + Vector.Mixin('controllableMovement', 'controllableMovementX', 'controllableMovementY', { track: true, }), ); @@ -24,7 +24,7 @@ export default () => class Controllable extends decorate(Trait) { constructor() { super(); - this.on('movementChanged', this.updateAnimation, this); + this.on('controllableMovementChanged', this.updateAnimation, this); } static dependencies() { @@ -52,16 +52,16 @@ export default () => class Controllable extends decorate(Trait) { this.entity.activeSlotIndex = (this.entity.activeSlotIndex + 9) % 10; break; case 'MoveUp': - this.y -= normalized; + this.controllableMovementY -= normalized; break; case 'MoveRight': - this.x += normalized; + this.controllableMovementX += normalized; break; case 'MoveDown': - this.y += normalized; + this.controllableMovementY += normalized; break; case 'MoveLeft': - this.x -= normalized; + this.controllableMovementX -= normalized; break; case 'UseItem': if ('client' !== process.env.SIDE) { @@ -88,13 +88,13 @@ export default () => class Controllable extends decorate(Trait) { if (this.#itemPromise && this.#itemPromise instanceof TickingPromise) { this.#itemPromise.tick(elapsed); } - if (this.entity.isMobile && !Vector.isZero(this.movement)) { - this.entity.requestMovement(this.movement); + if (this.entity.isMobile && !Vector.isZero(this.controllableMovement)) { + this.entity.requestMovement(this.controllableMovement); } } updateAnimation() { - if (!this.entity.isMobile || Vector.isZero(this.movement)) { + if (!this.entity.isMobile || Vector.isZero(this.controllableMovement)) { this.entity.currentAnimation = 'idle'; } else {