From 66ed7312fd05dcaf699f7ddc8f55d46264d4aafb Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 6 Aug 2012 04:17:28 +0200 Subject: [PATCH] Add real GetTilePosition function --- map_isometric.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/map_isometric.js b/map_isometric.js index b3bbf66..d6b2796 100644 --- a/map_isometric.js +++ b/map_isometric.js @@ -63,6 +63,8 @@ if(RadiumEngine !== undefined) for(var r = 0; r < this.width; r++) { this.DrawTile(r, i); + pos = this.GetTilePosition(r, i); + this.context.fillRect(pos.x, pos.y, 1, 1); } } } @@ -151,5 +153,12 @@ if(RadiumEngine !== undefined) /* Return the sum of the above to determine the actual tile position on the canvas. */ return base_point.Add(row_offset, tile_offset); } + + this.GetTilePosition = function(tile_x, tile_y) + { + origin = this.GetTileOrigin(tile_x, tile_y); + + return origin.Add(new RadiumEngine.Point(0 - (this.tile_width / 2), 0)); + } } }