public ActionAnimate() { var animation = new CCAnimation(); for (var i = 1; i < 15; i++) { var szName = String.Format("Images/grossini_dance_{0:00}", i); animation.AddSpriteFrame(szName); } // Should last 2.8 seconds. And there are 14 frames. animation.DelayPerUnit = 2.8f / 14.0f; animation.RestoreOriginalFrame = true; action = new CCAnimate(animation); var cache = CCAnimationCache.SharedAnimationCache; cache.AddAnimations("animations/animations-2.plist"); var animation2 = cache["dance_1"]; action2 = new CCAnimate (animation2); var animation3 = animation2.Copy(); animation3.Loops = 4; action3 = new CCAnimate (animation3); }
private void createActions() { //swing action for health drops CCFiniteTimeAction easeSwing = new CCSequence( new CCEaseInOut(new CCRotateTo(1.2f, -10), 2), new CCEaseInOut(new CCRotateTo(1.2f, 10), 2)); _swingHealth = new CCRepeatForever(easeSwing); //_swingHealth ->retain(); //action sequence for shockwave: fade out, call back when done _shockwaveSequence = new CCSequence( new CCFadeOut(1.0f), new CCCallFunc(shockwaveDone)); //_shockwaveSequence->retain(); //action to grow bomb _growBomb = new CCScaleTo(6.0f, 1); //_growBomb->retain(); //action to rotate sprites _rotateSprite = new CCRepeatForever(new CCRotateBy(0.5f, -90)); //_rotateSprite->retain(); //sprite animations CCAnimation animation; var spriteFrameCache = CCSpriteFrameCache.SharedSpriteFrameCache; animation = new CCAnimation(); CCSpriteFrame frame; int i; //animation for ground hit for (i = 1; i <= 10; i++) { frame = spriteFrameCache[String.Format("boom{0}.png", i)]; animation.AddSpriteFrame(frame); } animation.DelayPerUnit = (1 / 10.0f); animation.RestoreOriginalFrame = true; _groundHit = new CCSequence( new CCMoveBy(0, new CCPoint(0, _screenSize.Height * 0.12f)), new CCAnimate(animation), new CCCallFuncN(animationDone)); //_groundHit->retain(); animation = new CCAnimation(); //animation for falling object explosion for (i = 1; i <= 7; i++) { frame = spriteFrameCache[String.Format("explosion_small{0}.png", i)]; animation.AddSpriteFrame(frame); } animation.DelayPerUnit = 0.5f / 7.0f; animation.RestoreOriginalFrame = true; _explosion = new CCSequence( new CCAnimate(animation), new CCCallFuncN(animationDone) ); ; // _explosion->retain(); }