Hey cocos2d! I'm starting a new tile-based game and I decided to roll my own level editor so I can have total control over how it works. Since I don't really know how to write Mac apps, and I want to end up sharing a lot of code between the level editor and the actual game, I decided to write the level editor as an iPhone app and use cocos2d for it.
Each screen has 16x10 tiles, with each tile be 30x32 pixels (making a total of 480x320). The problem I'm having is even when I place all the tiles in the perfect positions, they're not quite lining up correctly. The easiest way to explain is with this video I made of the simulator running my level editor: http://www.insurgentgames.com/files/map_editor.mov (also I'm proud of it, so here's a good place to show it off :))
As you can see, there's spaces between the tiles, mostly in the top left areas, but not in the bottom left areas. I'm pretty sure my math of where to place the centers of each tile is perfect. Just looking at it I have the feeling that it has something to do with OpenGL and the camera position, but I don't actually have any evidence to support that.
I'm using version 0.0.9alpha and all of the sprites are stored in the same file, TilesetForest.png. And loading sprites looks something like this:
sprite = [CCSprite spriteWithFile:@"TilesetForest.png" rect:CGRectMake(4*30, 0, 30, 32)];
So if I'm placing lots of equally sized sprites right next to each other, how come there are gaps between them? Has anyone else had this problem before?
Thanks so much!