Breaking News
Home / iOS / iOS Snippets / How can you cache CCAnimation in Cocos2D?

How can you cache CCAnimation in Cocos2D?

Cocos2D provides a simple way to cache you Animations using CCAnimationCache class.
The CCAnimationCache is implemented as a singleton which can be accessed using the [CCAnimationCache sharedAnimationCache] method.This approach is particularly useful if the animation steps are common across more than one sprites.

  1. [[CCAnimationCache sharedAnimationCache] addAnimation:animationToCache name:@"NameOfAnimation"];
  2.  
  3.  
  4. CCAnimation *myAnimation = [[CCAnimationCache sharedAnimationCache]
  5. animationByName:@"NameOfAnimation"];
[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger