Example #1
0
 public CCFlipXState(CCFlipX action, CCNode target)
     : base(action, target)
 {
     if (!(target is CCSprite))
     {
         throw (new System.NotSupportedException("FlipX and FlipY actions only work on CCSprite instances."));
     }
     ((CCSprite)(target)).FlipX = action.FlipX;
 }
Example #2
0
        public CCFlipXState (CCFlipX action, CCNode target)
            : base (action, target)
        {   

            if (!(target is CCSprite))
            {
                throw (new System.NotSupportedException ("FlipX and FlipY actions only work on CCSprite instances."));
            }
            ((CCSprite)(target)).FlipX = action.FlipX;      
        }
Example #3
0
        public override object Copy(ICopyable pZone)
        {
            CCFlipX pRet;

            if (pZone != null)
            {
                pRet = (CCFlipX)(pZone);
            }
            else
            {
                pRet  = new CCFlipX();
                pZone = (pRet);
            }

            base.Copy(pZone);
            pRet.InitWithFlipX(m_bFlipX);
            return(pRet);
        }
Example #4
0
        public override object Copy(ICopyable pZone)
        {
            CCFlipX pRet;

            if (pZone != null)
            {
                pRet = (CCFlipX) (pZone);
            }
            else
            {
                pRet = new CCFlipX();
                pZone =  (pRet);
            }

            base.Copy(pZone);
            pRet.InitWithFlipX(m_bFlipX);
            return pRet;
        }
        public SpriteAnimationSplit()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCTexture2D texture = CCTextureCache.sharedTextureCache().addImage("animations/images/dragon_animation");

            // manually add frames to the frame cache
            CCSpriteFrame frame0 = CCSpriteFrame.frameWithTexture(texture, new CCRect(132 * 0, 132 * 0, 132, 132));
            CCSpriteFrame frame1 = CCSpriteFrame.frameWithTexture(texture, new CCRect(132 * 1, 132 * 0, 132, 132));
            CCSpriteFrame frame2 = CCSpriteFrame.frameWithTexture(texture, new CCRect(132 * 2, 132 * 0, 132, 132));
            CCSpriteFrame frame3 = CCSpriteFrame.frameWithTexture(texture, new CCRect(132 * 3, 132 * 0, 132, 132));
            CCSpriteFrame frame4 = CCSpriteFrame.frameWithTexture(texture, new CCRect(132 * 0, 132 * 1, 132, 132));
            CCSpriteFrame frame5 = CCSpriteFrame.frameWithTexture(texture, new CCRect(132 * 1, 132 * 1, 132, 132));

            //
            // Animation using Sprite BatchNode
            //
            CCSprite sprite = CCSprite.spriteWithSpriteFrame(frame0);

            sprite.position = (new CCPoint(s.width / 2 - 80, s.height / 2));
            addChild(sprite);

            List <CCSpriteFrame> animFrames = new List <CCSpriteFrame>(6);

            animFrames.Add(frame0);
            animFrames.Add(frame1);
            animFrames.Add(frame2);
            animFrames.Add(frame3);
            animFrames.Add(frame4);
            animFrames.Add(frame5);

            CCAnimation      animation = CCAnimation.animationWithFrames(animFrames, 0.2f);
            CCAnimate        animate   = CCAnimate.actionWithAnimation(animation, false);
            CCActionInterval seq       = (CCActionInterval)(CCSequence.actions(animate,
                                                                               CCFlipX.actionWithFlipX(true),
                                                                               (CCFiniteTimeAction)animate.copy(),
                                                                               CCFlipX.actionWithFlipX(false)
                                                                               ));

            sprite.runAction(CCRepeatForever.actionWithAction(seq));
            //animFrames->release();    // win32 : memory leak    2010-0415
        }
Example #6
0
 protected CCFlipX(CCFlipX flipX) : base(flipX)
 {
     InitWithFlipX(m_bFlipX);
 }
Example #7
0
 protected CCFlipX(CCFlipX flipX) : base(flipX)
 {
     InitWithFlipX(m_bFlipX);
 }
Example #8
0
 public static CCFlipX Create(bool x)
 {
     var pRet = new CCFlipX();
     pRet.InitWithFlipX(x);
     return pRet;
 }