Refactor Maps (#2)

This commit is contained in:
gavin
2018-07-17 21:28:17 +00:00
committed by Gitea
parent 0545c0a5d9
commit 57ada13a8d
13 changed files with 167 additions and 86 deletions

View File

@@ -1,23 +1,31 @@
import {random} from './utils.js';
import {
HEX, CIRCLE, SQUARE,
FLAT, POINTY,
FILL, OUTLINE,
} from './consts.js';
const DEFAULTS = {
x: 0,
y: 0,
scale: 10,
orientation: FLAT,
tileStyle: HEX,
drawStyle: FILL,
width: 1,
red: 0,
green: 0,
blue: 0,
alpha: 0.5,
};
export default class Cell {
constructor(settings) {
this.getColor = this.getColor.bind(this);
this.x = 0;
this.y = 0;
this.scale = 10;
this.pointyTop = false;
this.tile = 'circle';
this.style = 'filled';
this.width = 1;
this.red = 0;
this.green = 0;
this.blue = 0;
this.alpha = 0.5;
this.created = Date.now();
Object.assign(this, settings);
Object.assign(this, DEFAULTS, settings);
}
getColor() {