开发者

Tilemap Coordinates for Tiled hexagons

开发者 https://www.devze.com 2023-03-12 00:48 出处:网络
I\'ve been wrestling with this and decided to ask for assistance. Scenario: Tiles Width: 340Height: 160

I've been wrestling with this and decided to ask for assistance.

Scenario:

Tiles Width: 340 Height: 160

By definition, a hexagon has 6 equal sides. With the above dimensions that开发者_JS百科's no longer the case. It more resembles a diamond. Finding the coordinates for a traditional hexagon in cocos2d is easily located in a Google search. I can't figure out the equation I need to calculate tile coordinates in the irregular hexagon. When sketched on paper it's essentially two isosceles trapezoids. On the cocos2d forums I found someone else with the same problem [cocos2d post]: http://www.cocos2d-iphone.org/forum/topic/17253.

Can anyone offer a solution or guidance?


Isn't it enough to scale it? Use functions you found for equally sided hexagon, create grid with hexagon side 160 and scale grid on width by 340/160.

0

精彩评论

暂无评论...
验证码 换一张
取 消