views:

54

answers:

0

I have gotten 0 response from the Cocos2D board so thought Id try here.

Ok. Im ripping out my hair over this. I did a complete re-haul of my code last night in hopes of fixing some iphone4 framerate issues. I created sprites in advance instead of doing some of the creation during the update methods. I only add them to the spritesheet now in the update method as needed.

However, this really didnt fix the issue. So I changed one thing out of curiosity. My main sprite sheet is 2048x2048 and contains 24 frames and one static frame. I used to pull my static image from the frames i generated using spriteWithSpriteFrameName. Instead I just decided to make another image file for it and create it from that. Framerate issue solved mostly...I dont understand why. I thought the texture was already in memory to begin with? Is anything wrong with my code?

circleSpriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"spritesheetbase.png"];

    //Load Note Animations
    for (int i = 0; i < 25; i++)
    {
            int x = i % 5;
     int y = i / 5;

     CCSpriteFrame* frame = [[CCSpriteFrame alloc] initWithTexture:circleSpriteSheet.textureAtlas.texture rect:CGRectMake(x * 200, y * 200, 200, 200)];
     [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFrame:frame name:[NSString stringWithFormat:@"noteFrame%d.png", i]];
     [frame release];
    }

    CCSprite *s = [CCSprite spriteWithFile:@"staticRing.png"];
    //CCSprite *s = [CCSprite spriteWithSpriteFrameName:@"noteFrame0.png"]; <--- Old way I used to create it

If someone could help I would be in your debt! I am so confused.