code cleanup

This commit is contained in:
Gavin McDonald
2018-07-06 13:46:50 -04:00
parent d3540ed117
commit 6e9d4a399c
2 changed files with 17 additions and 204 deletions

View File

@@ -152,36 +152,26 @@ export default class Tessellate {
const tiles = this.cartographer.boundingBox(upperLeft, upperRight, lowerLeft, lowerRight);
const height = tiles.length;
for (let r=0; r<height; r++) {
let width = tiles[r].length;
tiles.forEach(row => row.forEach(tile => {
const tilePoint = this.cartographer.tileToPixel(tile);
for (let c=0; c<width; c++) {
let tile = tiles[r][c];
let tilePoint = this.cartographer.tileToPixel(tile);
if (!this.map[tile.getX()]) this.map[tile.getX()] = [];
if (!this.map[tile.getX()]) this.map[tile.getX()] = [];
if (!this.map[tile.getX()][tile.getY()]) {
this.map[tile.getX()][tile.getY()] = new Cell({
x: tile.getX(),
y: tile.getY(),
pointyTop: this.settings.pointyTop,
red: utils.random(64, 192),
green: utils.random(64, 192),
blue: utils.random(64, 192),
alpha: 0.75,
scale: utils.random(7, 9) / 10
});
}
TILES[this.settings.tile].filled(context, scale, tilePoint.getX(), tilePoint.getY(), this.map[tile.getX()][tile.getY()]);
// let cell = map.getXY(hex.getX(), hex.getY());
//
// hexTiles.filled(hexPoint.getX(), hexPoint.getY(), scale * 0.9, {color: cell.getColor()});
if (!this.map[tile.getX()][tile.getY()]) {
this.map[tile.getX()][tile.getY()] = new Cell({
x: tile.getX(),
y: tile.getY(),
pointyTop: this.settings.pointyTop,
red: utils.random(64, 192),
green: utils.random(64, 192),
blue: utils.random(64, 192),
alpha: 0.75,
scale: utils.random(7, 9) / 10
});
}
}
TILES[this.settings.tile].filled(context, scale, tilePoint.getX(), tilePoint.getY(), this.map[tile.getX()][tile.getY()]);
}));
}
draw(context) {