diff --git a/assets/index.html b/assets/index.html
index e2f6433..707a4df 100644
--- a/assets/index.html
+++ b/assets/index.html
@@ -71,7 +71,7 @@
}
}
- function drawTile(wx, wy, h, water, hLeft, hFront) {
+ function drawTile(wx, wy, h, water, hRight, hBack) {
var top1 = project(wx + GAP/2, wy + TILE - GAP/2, h * HEIGHT_UNIT);
var top2 = project(wx + TILE - GAP/2, wy + TILE - GAP/2, h * HEIGHT_UNIT);
var top3 = project(wx + TILE - GAP/2, wy + GAP/2, h * HEIGHT_UNIT);
@@ -90,24 +90,24 @@
ctx.closePath();
ctx.fill();
- if (hLeft < h) {
- ctx.fillStyle = leftColor;
+ if (hRight < h) {
+ ctx.fillStyle = rightColor;
ctx.beginPath();
- ctx.moveTo(top4[0], top4[1]);
- ctx.lineTo(top1[0], top1[1]);
- ctx.lineTo(top1[0], top1[1] + (h - hLeft) * HEIGHT_UNIT);
- ctx.lineTo(top4[0], top4[1] + (h - hLeft) * HEIGHT_UNIT);
+ ctx.moveTo(top2[0], top2[1]);
+ ctx.lineTo(top3[0], top3[1]);
+ ctx.lineTo(top3[0], top3[1] + (h - hRight) * HEIGHT_UNIT);
+ ctx.lineTo(top2[0], top2[1] + (h - hRight) * HEIGHT_UNIT);
ctx.closePath();
ctx.fill();
}
- if (hFront < h) {
- ctx.fillStyle = rightColor;
+ if (hBack < h) {
+ ctx.fillStyle = leftColor;
ctx.beginPath();
- ctx.moveTo(top3[0], top3[1]);
- ctx.lineTo(top4[0], top4[1]);
- ctx.lineTo(top4[0], top4[1] + (h - hFront) * HEIGHT_UNIT);
- ctx.lineTo(top3[0], top3[1] + (h - hFront) * HEIGHT_UNIT);
+ ctx.moveTo(top1[0], top1[1]);
+ ctx.lineTo(top2[0], top2[1]);
+ ctx.lineTo(top2[0], top2[1] + (h - hBack) * HEIGHT_UNIT);
+ ctx.lineTo(top1[0], top1[1] + (h - hBack) * HEIGHT_UNIT);
ctx.closePath();
ctx.fill();
}
@@ -130,10 +130,10 @@
var water = isWater(h);
- var hLeft = heightMap[(wx - TILE) + ',' + wy] || 0;
- var hFront = heightMap[wx + ',' + (wy - TILE)] || 0;
+ var hRight = heightMap[(wx + TILE) + ',' + wy] || 0;
+ var hBack = heightMap[wx + ',' + (wy + TILE)] || 0;
- drawTile(wx, wy, h, water, hLeft, hFront);
+ drawTile(wx, wy, h, water, hRight, hBack);
}
}