MultiplayerMinesweeper/scripts/world/flagger.mjs

23 lines
419 B
JavaScript
Raw Normal View History

2022-06-22 01:51:09 +00:00
export function flag(x, y, data, player) {
let tile = data[x][y]
2022-06-22 01:51:09 +00:00
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
2022-06-22 01:51:09 +00:00
return data;
}