2017-12-18 14 views
0

코로나 SDK 타일로 만든 등각 투영 맵을 가져 와서 현재 격자 레이어를 오버레이하려고합니다. 등고선 그리드를 많이 읽었지만 높이가 절반 인 타일 세트를 참조하는 것으로 보입니다. (예 : 128x64 픽셀). 그리드에 256x149px가 필요한 타일셋을 사용하고 있는데, 그리드 생성 함수를 수정하여 변경 사항을 수용해야한다고 생각합니다. 어떤 도움이라도 대단히 감사하겠습니다! (원래 벡터를 사용) 문제의코로나 SDK의 타일셋 용 등각 투영 격자 생성

스크린 샷 :

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

격자 생성 코드 : 당신이 스크린 샷 타일에서 볼 수 있듯이

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 

지도의 측면에서 조금 벗어나십시오. 누군가 그것을 고치거나 정보에 대한 더 많은 정보를 필요로하는 것이 있다면 알려주십시오!

+0

Corona SDK에서 등각 투영지도를 렌더링하는 데 사용하는 것은 무엇입니까? – ldurniat

답변

0

try 코드 :

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 
     local 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 

     tile.x = -(row - col) * tileWidth * 0.5 
     tile.y = (row + col) * tileHeight * 0.5 

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

나는 Isometric Tiles Math에서 타일의 xy 위치에 대한 공식을 얻는다. 행운을 빌어 요 :)

+0

대단히 감사합니다! 나는 또한 Isometric Tiles Math 페이지에서 버그가 내가 무엇을 잘못하고 있는지 알 수 없다고 보았다. 당신의 솔루션은 성공했습니다! – Co1eK

관련 문제