Domanda

I am loading a sprite sheet with the code below:

[cache addSpriteFramesWithFile:[NSString stringWithUTF8String:plistPath] textureFilename:[NSString stringWithUTF8String:spritePath]];

Then I set my current frame of my animations using:

[this->fSprite setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithUTF8String:fAnimFSM->GetCurrentImageSequence()->fImages[frame]]]];

The correct frame comes up but it appears that the bottom frame of the frame directly above my current frame is also being rendered. As you can see in the below image you can see what looks like a 1 pixel horizontal line above my my current frame of animation.

1 pixel line above my current frame

The plist looks perfect to me, plus I have 5+ animations in my sprite sheet and only 1 animation suffers from this problem.

What could this be?

Thanks in advance.

È stato utile?

Soluzione

Leave a 2-pixel wide space in your texture atlas around every image. Tools like TexturePacker can be configured (and default to) using the 2-pixel wide margin. Without the 2-pixel gap glitches like the above are inevitable.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top