23 lines
419 B
JavaScript
23 lines
419 B
JavaScript
|
|
export function flag(x, y, data, player) {
|
|
let tile = data[x][y]
|
|
|
|
if (!tile.mask || tile.color === 0) return data
|
|
const color = player.color * 1
|
|
console.log(player)
|
|
|
|
switch (tile.flag) {
|
|
case (0):
|
|
tile.flag = color;
|
|
break;
|
|
case (color):
|
|
tile.flag = color + 16;
|
|
break;
|
|
default:
|
|
tile.flag = 0;
|
|
}
|
|
console.log(tile.flag)
|
|
data[x][y] = tile
|
|
return data;
|
|
}
|