import {System} from '@/ecs/index.js'; const SPEED = 100; export default class ControlMovement extends System { static queries() { return { default: ['Controlled', 'Momentum'], }; } tick() { for (const [controlled, momentum] of this.select('default')) { momentum.x = SPEED * (controlled.right - controlled.left); momentum.y = SPEED * (controlled.down - controlled.up); } } }