added tessellated map
This commit is contained in:
118
src/hex.js
118
src/hex.js
@@ -54,70 +54,68 @@ export default class Hex extends Point {
|
||||
roundOff(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
return {
|
||||
getX: function() {return this.x;},
|
||||
getY: function() {return this.y;},
|
||||
getZ: function() {return this.z;},
|
||||
getX() {return this.x;}
|
||||
getY() {return this.y;}
|
||||
getZ() {return this.z;}
|
||||
|
||||
setX: function(newX) {this.x = newX; return this;},
|
||||
setY: function(newY) {this.y = newY; return this;},
|
||||
setZ: function(newZ) {this.z = newZ; return this;},
|
||||
setX(newX) {this.x = newX; return this;}
|
||||
setY(newY) {this.y = newY; return this;}
|
||||
setZ(newZ) {this.z = newZ; return this;}
|
||||
|
||||
moveX: function(byX) {this.x += byX; return this;},
|
||||
moveY: function(byY) {this.y += byY; return this;},
|
||||
moveZ: function(byZ) {this.z += byZ; return this;},
|
||||
moveX(byX) {this.x += byX; return this;}
|
||||
moveY(byY) {this.y += byY; return this;}
|
||||
moveZ(byZ) {this.z += byZ; return this;}
|
||||
|
||||
getQ: function() {return this.x;},
|
||||
getR: function() {return this.z;},
|
||||
getQ() {return this.x;}
|
||||
getR() {return this.z;}
|
||||
|
||||
setQ: function(newQ) {
|
||||
this.x = newQ;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
},
|
||||
setR: function(newR) {
|
||||
this.z = newR;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
},
|
||||
setQ(newQ) {
|
||||
this.x = newQ;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
}
|
||||
setR(newR) {
|
||||
this.z = newR;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
}
|
||||
|
||||
moveQ: function(byQ) {
|
||||
this.x += byQ;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
},
|
||||
moveR: function(byR) {
|
||||
this.z += byR;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
},
|
||||
moveQ(byQ) {
|
||||
this.x += byQ;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
}
|
||||
moveR(byR) {
|
||||
this.z += byR;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
}
|
||||
|
||||
getHex: function() { return {x: this.x, y: this.y, z: this.z}; },
|
||||
setHex: function(newHex) {
|
||||
this.x = newHex.x;
|
||||
this.y = newHex.y;
|
||||
this.z = newHex.z;
|
||||
return this;
|
||||
},
|
||||
moveHex: function(byHex) {
|
||||
this.x += byHex.x;
|
||||
this.y += byHex.y;
|
||||
this.z += byHex.z;
|
||||
return this;
|
||||
},
|
||||
getHex() { return {x: this.x, y: this.y, z: this.z}; }
|
||||
setHex(newHex) {
|
||||
this.x = newHex.x;
|
||||
this.y = newHex.y;
|
||||
this.z = newHex.z;
|
||||
return this;
|
||||
}
|
||||
moveHex(byHex) {
|
||||
this.x += byHex.x;
|
||||
this.y += byHex.y;
|
||||
this.z += byHex.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
getAxial: function() {return {q: this.x, r: this.z};},
|
||||
setAxial: function(newAxial) {
|
||||
this.x = newAxial.q;
|
||||
this.z = newAxial.r;
|
||||
this.y = computeY(this.x, this.y);
|
||||
return this;
|
||||
},
|
||||
moveAxial: function(byAxial) {
|
||||
this.x += byAxial.q;
|
||||
this.z += byAxial.r;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
getAxial() {return {q: this.x, r: this.z};}
|
||||
setAxial(newAxial) {
|
||||
this.x = newAxial.q;
|
||||
this.z = newAxial.r;
|
||||
this.y = computeY(this.x, this.y);
|
||||
return this;
|
||||
}
|
||||
moveAxial(byAxial) {
|
||||
this.x += byAxial.q;
|
||||
this.z += byAxial.r;
|
||||
this.y = computeY(this.x, this.z);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user