Im having an extremely odd error with my sprites displaying. I have all my sprites in one big 2048x2048 spritesheet. This all worked in my last game, but Im getting bizarre issues this time. This is specifically for one sprite on my spritesheet, the main button. There are 6 of these (3 per row, 2 rows) all using the exact same sprite frame from the spritesheet. When I display them, the top row appears to have pixels below them, the bottom row is fine. If I change the sprites position of the bottom row and move them toward the upper half of the screen, they also get the pixels below them. I have no clue what is going on. Here is my code:
//Add main spritesheet
spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"gameplay_spritesheet.png"];
[self addChild:spriteSheet];;
//Create sprites
[self createSpriteFrames];
noteTargetSprites = [[CCArray alloc] initWithCapacity:6];
for (int row = 0; row < 2; row++)
{
for (int col = 0; col < 3; col++)
{
float posX, posY = 0;
if (col == 0)
posX = 90.0f;
else if (col == 1)
posX = screenSize.width / 2.0f;
else //col == 2
posX = screenSize.width - 90.0f;
if (row == 0)
posY = 90.0f;
else
posY = screenSize.height - 90.0f;
CCSprite *noteTargetSprite = [CCSprite spriteWithSpriteFrameName:@"noteTarget.png"];
[noteTargetSprite setPosition:CGPointMake(posX, posY)];
[spriteSheet addChild:noteTargetSprite];
[noteTargetSprites addObject:noteTargetSprite];
}
}
- (void) createSpriteFrames
{
//Frame Note Target
CCSpriteFrame* frameNoteTarget = [[CCSpriteFrame alloc] initWithTexture:spriteSheet.textureAtlas.texture rect:CGRectMake(0, 680, 48, 48)];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFrame:frameNoteTarget name:@"noteTarget.png"];
[frameNoteTarget release];
}