Skip to content

Instantly share code, notes, and snippets.

@lethern
Created June 27, 2020 18:33
Show Gist options
  • Save lethern/e8ea6a534d425689f0bf8c3276da8f44 to your computer and use it in GitHub Desktop.
Save lethern/e8ea6a534d425689f0bf8c3276da8f44 to your computer and use it in GitHub Desktop.
function renderMatrix(roomName, costMatrix, color = '#ff0000') {
var vis = Game.rooms[roomName].visual;
const array = costMatrix._bits;
var max = _.max(array);
for (var x = 0; x < 50; ++x) {
for (var y = 0; y < 50; ++y) {
var value = array[x * 50 + y];
if (value > 0) {
vis.circle(x, y, { radius: value / max / 2, fill: color });
//vis.text(value, x, y);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment