UNPKG

@real_one_chess_king/game-logic

Version:
15 lines 776 B
import { buildMoveAffect, markAsUserSelected } from "../../affect/affect.utils"; import { Direction } from "./movement-rule"; import { directionToVector, StraightMovementRule, } from "./straight-movement.rule"; export class HorizontalMovementRule extends StraightMovementRule { constructor({ id, name, moveToEmpty, moveToKill, collision, distance, directions, speed, }) { super(id, name, moveToEmpty, moveToKill, collision, distance, directions, speed); } possibleDirrections = [Direction.Left, Direction.Right]; calculateNewCoord = (x, y, diff, dirrection) => { return [ markAsUserSelected(buildMoveAffect([x, y], directionToVector(dirrection, x, y, diff))), ]; }; } //# sourceMappingURL=horizontal-movement.rule.js.map