Weird black lines between sprites in Cocos2d-x

Today, while building a sample game, I noticed that there were weird black lines between my sprites. Since the sprites are exact size and I am drawing them at integer coordinates exactly, that did not make any sense.

After messing around for a while, the culprit was TexturePacker that I used to pack all my sprites. When you are tiling sprites to create a tiled background, it is a good idea to set “Extrude” property on the right hand side to one so that these weird artifacts don’t show up. Here are the two screenshots with and without the problem.

 

artifacts
no_artifacts_

Leave a comment

Your email address will not be published. Required fields are marked *