Commit 248a5f6e authored by Tobias Bengfort's avatar Tobias Bengfort
Browse files

highlight limit

parent b2ffceb7
Pipeline #1791 canceled with stage
......@@ -2,16 +2,23 @@ import scenarios from './scenarios.js';
const h = petitDom.h;
const getSpaceClass = function(state, y, x) {
if (
(state.game.limitBuildSpace) &&
(x < state.game.limitBuildSpace.x1 || x > state.game.limitBuildSpace.x2 || y < state.game.limitBuildSpace.y1 || y > state.game.limitBuildSpace.y2)
) return 'limit-outside';
};
const renderBoard = function(state) {
return h(
'div',
{'class': 'board'},
state.game.board.map(row => h(
state.game.board.map((row, y) => h(
'div',
{'class': 'board-row'},
row.map(player => h(
row.map((player, x) => h(
'div',
{'class': `board-cell bg-${player}`}
{'class': `board-cell bg-${player} ${getSpaceClass(state, y, x)}`}
))
))
);
......
......@@ -122,3 +122,7 @@ input[type=range]:focus::-webkit-slider-thumb {
.bg-2 {--cell-color: var(--player2); z-index: 1}
.bg-3 {--cell-color: var(--player3); z-index: 1}
.bg-4 {--cell-color: var(--player4); z-index: 1}
.bg-0.limit-outside {
opacity: 0.7;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment