Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hexagonal TileMap Bounding Box Issue #523

Closed
billykan opened this issue Sep 23, 2013 · 4 comments
Closed

Hexagonal TileMap Bounding Box Issue #523

billykan opened this issue Sep 23, 2013 · 4 comments

Comments

@billykan
Copy link

Hi,

I've just started developing iOS games and want to develop one which needs a hexagonal tiled map. While Qt version of Tiled does not support hexagonal map, the Java version did and so I downloaded it and gave it a try.

I created a simple map successfully and can load it in my cocos2d app. However when I try to place it at the centre of the screen by the following code:

self.tiledMap = [CCTMXTiledMap tiledMapWithTMXFile:kTMXFileName];
[self addChild:self.tiledMap z:-1];
CCDirector *director = [CCDirector sharedDirector];
CGSize winSize = director.winSize;
self.tiledMap.anchorPoint = ccp(0.5f, 0.5f);
self.tiledMap.position = ccp(winSize.width/2.0f, winSize.height/2.0f);

I found that the tilemap wasn't placed exactly at the centre. To investigate the issue, I draw the bounding box (in white) of the map and see the following:

screen shot 2013-09-23 at 2 33 49 pm

It seems that the bounding box is wrong. It leaves a lot of space at the right and does not cover the 2 bottommost hexagons.

I did not find any hint of how the bounding box is set and no such settings is available in Tiled. Any help is greatly appreciated.

Billy

@bjorn
Copy link
Member

bjorn commented Sep 23, 2013

Tiled does not store the bounding box into the map file, since it can be derived from the map orientation, size and the tile sizes. Hence, if you're getting the bounding box for this hexagonal map from cocos2d-iphone, then this would indicate a bug in that library and not in Tiled. Please ask for help through their support channels.

@bjorn bjorn closed this as completed Sep 23, 2013
@billykan
Copy link
Author

Thanks Bjorn. I will write to cocos2d forum.

@tomschulz
Copy link

Wheres a sexy spritekit hex map library ? Am I gonna have to write the mofo ?

@bjorn
Copy link
Member

bjorn commented Jan 10, 2014

@tomschulz There's a Sprite Kit based library for Tiled maps here: http://koboldkit.com, which is open source so it should be a good start when you're interested in hexagonal rendering.

Unfortunately the current version of Tiled doesn't support hexagonal maps yet, but you could try one of the forks mentioned at #1 or the old Java version for editing hexagonal maps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants