diff --git a/app/ecs-systems/apply-control-movement.js b/app/ecs-systems/apply-control-movement.js index 423a0f2..a17aca3 100644 --- a/app/ecs-systems/apply-control-movement.js +++ b/app/ecs-systems/apply-control-movement.js @@ -2,16 +2,14 @@ import {System} from '@/ecs/index.js'; export default class ApplyControlMovement extends System { - static queries() { - return { - default: ['Controlled', 'Momentum', 'Speed'], - }; - } - tick() { - for (const [Controlled, Momentum, Speed] of this.select('default')) { - Momentum.x = Speed.speed * (Controlled.moveRight - Controlled.moveLeft); - Momentum.y = Speed.speed * (Controlled.moveDown - Controlled.moveUp); + const {diff} = this.ecs; + for (const id in diff) { + if (diff[id].Controlled) { + const {Controlled, Momentum, Speed} = this.ecs.get(id); + Momentum.x = Speed.speed * (Controlled.moveRight - Controlled.moveLeft); + Momentum.y = Speed.speed * (Controlled.moveDown - Controlled.moveUp); + } } }