Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:31:55+00:00 2026-06-11T04:31:55+00:00

Is there perhaps some best practice to caching CCAnimations in Cocos2D? Currently I am

  • 0

Is there perhaps some best practice to caching CCAnimations in Cocos2D? Currently I am basically recalculating an “appear” animation for a sprite every time it appears on the screen. Wouldn’t it be wise to cache the animation in the instance class somehow?

Currently, I run this code like thousands of times for some given game conditions:

CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"WichserAnimations.plist"];

NSMutableArray* frames = [NSMutableArray arrayWithCapacity:8];
for (int i = 41; i <= 48; i++) {
    NSString* file = [NSString stringWithFormat:@"intro_prep__Main_000%i.png", i];
    CCSpriteFrame* frame = [frameCache spriteFrameByName:file];
    [frames addObject:frame];
}

CCAnimation* anim    = [CCAnimation animationWithSpriteFrames:frames delay:0.05f];
CCAnimate*   connect = [CCAnimate actionWithAnimation:anim];        
[self runAction:connect];

I thought of putting the “connect” CCAnimate object into the sprite for later re-use, but this does not seem to work 🙁 any advice will be highly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:31:57+00:00Added an answer on June 11, 2026 at 4:31 am

    The animation cache class is called CCAnimationCache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've done some searching on this but can't find any sort of best practice
I appear to be reading in circles, or perhaps am simply not grasping some
Does anyone have a good VBA way (or perhaps there is an MS Word
Is there an equivalent to 'intellisense' for Python? Perhaps i shouldn't admit it but
Is there any way to simplify this method? Perhaps a way to && both
Are there any editors that can edit multi-gigabyte text files, perhaps by only loading
is there anyway to save the following flash video locally, perhaps by streaming it
I am wondering if there are best practices for deciding between when a system
I'm currently reading 'Javascript Web Applications' (O'Reilly, Alex MacCaw) and very early on there's
I'm looking for sort of a 'best practice' way to tackle this common scenario.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.