Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Need Help Generating isometric grid for Tileset
Started by colekostreva Dec 18 2017 07:04 PM

No replies to this topic
isometric tileset generation incorrect spacing vectors polygons geometry jumper tiled
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

colekostreva

[GLOBAL: userInfoPane.html]
colekostreva
  • Observer

  • 13 posts
  • Corona SDK

I imported an isometric map made in tiled to Corona SDK and am now trying to overlay a grid layer. I've done a lot of reading into isometric grids but it seems they all reference tilesets where the height is half the width. (ex. 128x64px ). I am using a tileset that requires the grid to be 256x149px and I think I have to edit the grid generation function to accommodate the change. Any help would be greatly appreciated!

Screenshots of the issue:

Original Vectors: https://image.ibb.co/emXpQR/Screen_Shot_2017_12_18_at_1_35_19_PM.png

Edited Vectors (the ones commented out in code): https://image.ibb.co/ikxOkR/Screen_Shot_2017_12_18_at_1_35_54_PM.png

Grid Generation Code:

function drawGrid()
for row = 0, 16 do
local gridRow = {}
for col = 0, 9 do

-- draw a diamond shaped tile
local vertices = { 0,-16, -64,16, 0,48, 64,16 }
-- MY EDITED VERTICES { 0,-37.25, -128,37.25, 0,111.75, 128,37.25 }
local tile = display.newPolygon(group, 0, 0, vertices )

-- outline the tile and make it transparent
tile.strokeWidth = 1
tile:setStrokeColor( 0, 1, 1 )
tile.alpha = .4

local tileWidth = 256
local tileHeight = 149

-- set the tile's x and y coordinates
local x = col * tileHeight
local y = row * tileHeight

tile.x = (x - y)
tile.y = ((tileHeight/2) + ((x + y)/2))

-- make a tile walkable
gridRow[col] = 0
end
-- add gridRow table to the map table
j_map[row] = gridRow
end
end

As you can see in the screenshots the tiles kind of veer off the side of the map. If anyone knows how to fix it or needs more info on the issue let me know!




[topic_controls]
[/topic_controls]