while rendering ccSprites near each other there are gliches and they don't fit well!

I’ve first encountered this issue while working with CCTMXTileMap class, i don’t know why but when sprites are set to be near eachother there are some dark lines in the window, then i’ve tested if the same problem exist if i only work with CCSprite and then i saw just the same line at same positions, this is a screenshot of my program a screenshot of my program (this one uses CCSprites and i’m manualy setting texture coordinates but there is no diffrence if i only attach CCTMXTileMap as a child), and i’ve tested on an iphone the problem existes there also, there are two thing i’m so confused about: first why are these lines only in some places (you can see there are some random gliches all over the sample some are vertical and some are horizontal) and the second thing is when i try to move my tilemap(for example i tryed CCMoveBy::actionWithDuration(1,ccp(–1,0))), it seems like colums move one by one and create a wave instead of all moving together. i mean you first see only the first colum moves then only the second and after that only the third one, and so on then the cycle repeats from the begining.


cocos2d-pr.png (84.4 KB)


desert.tmx.zip (0.5 KB)


tmw_desert_spacing.png (21.7 KB)

Can you post your invoking source here, or send email to me ?
I’m trying to reproduce this bug.

here’s the source code (there are just a few lines added to helloworld sample!)

i’ve tested this bug with 3 diffrent approches:

1- attach tmxTileMap itself to the layer
2- detach every tile from Tilemap and attach them to tayer seperately
3- try reconstructing Tilemap from plain texture (and ofcourse again i use Tilemap to know GID at each Tile)

all 3 are commented in this code and i’ve made no changes to any file other than this one. it should reproduce the problem if you just add these lines to the end of your HelloWorldScene::init() function in your helloworld sample.

    // here is to test CCTMXTiledMap
    CCTMXTiledMap * map =  CCTMXTiledMap::tiledMapWithTMXFile("desert.tmx");
    // if you want to check the TileMap itself
    this->addChild(map);

    /*
    // if you want to change the Tilemap broken to it's CCSprites
    CCAction* a = CCRepeatForever::actionWithAction(CCMoveBy::actionWithDuration(1,ccp(-1,0)));
    for(int i=0;ilayerNamed("Layer 0")->getLayerSize().width;i++)
        for(int j=0;jlayerNamed("Layer 0")->getLayerSize().height;j++)
        {
            CCSprite* sp = map->layerNamed("Layer 0")->tileAt(ccp(i,j));
            sp->retain();
            map->layerNamed("Layer 0")->removeTileAt(ccp(i,j));
            sp->setPosition(ccp(i*32,j*32));
            //sp->runAction(CCRepeatForever::actionWithAction(CCMoveBy::actionWithDuration(1,ccp(-1,0))));
            this->addChild(sp); 
        }*/

    /*
    // and this one to check the Tilemap reconstructed using original texture
    CCTexture2D* tex = CCTextureCache::sharedTextureCache()->addImage("tmw_desert_spacing.png");
    for(int i=0;ilayerNamed("Layer 0")->getLayerSize().width;i++)
        for(int j=0;jlayerNamed("Layer 0")->getLayerSize().height;j++)
        {
            int x = (map->layerNamed("Layer 0")->tileGIDAt(ccp(i,j))-1)%8;
            int y = (map->layerNamed("Layer 0")->tileGIDAt(ccp(i,j))-1)/8;
            CCSprite* s = CCSprite::spriteWithTexture(tex,CCRect(x*32,y*32,32,32));
            s->setPosition(ccp(i*32+16,320-j*32-16));
            //s->runAction(CCRepeatForever::actionWithAction(CCMoveBy::actionWithDuration(.1,ccp(-1,0))));
            this->addChild(s);
        }*/

did anyone check if there is a problem with how i’m using ccSprites or if there is realy a bug in SDK?

I have tested your code, and have no problem.
The broken.jpg is the result of method 2 (if you want to change the Tilemap broken to it’s CCSprites ).

The reconstruct.jpg is the result of method 3 (and this one to check the Tilemap reconstructed using original texture).