City.getView() With Elevated Terrain
Posted: 01 Apr 2021, 18:53
I noticed that City.getView() does not account for tiles on elevated terrain. It will only see tiles on level zero. Is there any way around this limitation?
A feature rich city builder game for Android, iOS and PC
https://forum.theotown.com/
Code: Select all Reset
function script:draw() local x, y = City.getView() if Tile.isValid(x, y) then x = x + Tile.getTerrainHeight (x, y) y = y - Tile.getTerrainHeight (x, y) end Drawing.setTile(x, y) Drawing.drawTileFrame(Icon.TOOLMARK + 16 + 1) end
Code: Select all Reset
function script:update() local x, y, scale = City.getView() if Tile.isValid(x, y) then x = x + Tile.getTerrainHeight (x, y) y = y - Tile.getTerrainHeight (x, y) end Drawing.drawText('X:'..x..',Y:'..y..',S:'..s) end