/** changes the display frame based on an animation and an index. */ public void setDisplayFrame(String animationName, int frameIndex) { if (animations_ == null) initAnimationDictionary(); CCAnimation anim = animations_.get(animationName); CCSpriteFrame frame = (CCSpriteFrame) anim.frames().get(frameIndex); setDisplayFrame(frame); }
/** adds an Animation to the Sprite. */ public void addAnimation(CCAnimation anim) { // lazy alloc if (animations_ == null) initAnimationDictionary(); animations_.put(anim.name(), anim); }