@real_one_chess_king/game-logic
Version:
R.O.C.K. chess game logic
15 lines • 773 B
JavaScript
import { buildMoveAffect, markAsUserSelected } from "../../affect/affect.utils";
import { Direction } from "./movement-rule";
import { directionToVector, StraightMovementRule, } from "./straight-movement.rule";
export class VerticalMovementRule extends StraightMovementRule {
constructor({ id, name, moveToEmpty, moveToKill, collision, distance, directions, speed = 1, }) {
super(id, name, moveToEmpty, moveToKill, collision, distance, directions, speed);
}
possibleDirrections = [Direction.Up, Direction.Down];
calculateNewCoord = (x, y, diff, dirrection) => {
return [
markAsUserSelected(buildMoveAffect([x, y], directionToVector(dirrection, x, y, diff))),
];
};
}
//# sourceMappingURL=vertical-movement.rule.js.map