import {System} from '@/ecs/index.js'; export default class ControlDirection extends System { tick() { for (const {Controlled, Direction} of this.ecs.changed(['Controlled'])) { const {locked, moveUp, moveRight, moveDown, moveLeft} = Controlled; if (locked) { continue; } if (moveUp > 0) { Direction.direction = 0; } if (moveDown > 0) { Direction.direction = 2; } if (moveLeft > 0) { Direction.direction = 3; } if (moveRight > 0) { Direction.direction = 1; } } } }