/** 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); }
protected void init(CCSpriteFrame spriteFrame) { assert spriteFrame != null : "Invalid spriteFrame for sprite"; rectRotated_ = spriteFrame.rotated_; init(spriteFrame.getTexture(), spriteFrame.getRect()); setDisplayFrame(spriteFrame); }