예제 #1
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval effect = (CCActionInterval)(CCSequence.actions(CCDelayTime.actionWithDuration(2.0f), CCShaky3D.actionWithRange(16, false, new ccGridSize(5, 5), 5.0f)));

            // cleanup
            CCNode bg = getChildByTag(EffectAdvanceScene.kTagBackground);

            removeChild(bg, true);

            // background
            CCLayerColor layer = CCLayerColor.layerWithColor(new ccColor4B(255, 0, 0, 255));

            addChild(layer, -10);
            CCSprite sprite = CCSprite.spriteWithFile("Images/grossini");

            sprite.position = new CCPoint(50, 80);
            layer.addChild(sprite, 10);

            // foreground
            CCLayerColor layer2 = CCLayerColor.layerWithColor(new ccColor4B(0, 255, 0, 255));
            CCSprite     fog    = CCSprite.spriteWithFile("Images/Fog");

            ccBlendFunc bf = new ccBlendFunc {
                src = 0x0302, dst = 0x0303
            };

            fog.BlendFunc = bf;
            layer2.addChild(fog, 1);
            addChild(layer2, 1);

            layer2.runAction(CCRepeatForever.actionWithAction(effect));
        }
예제 #2
0
        public override void onEnter()
        {
            base.onEnter();

            CCNode target = getChildByTag(EffectAdvanceScene.kTagBackground);

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     ShakyTiles is TiledGrid3D and it's size is (15,10)
            //     Shuffletiles is TiledGrid3D and it's size is (15,10)
            //	   TurnOfftiles is TiledGrid3D and it's size is (15,10)
            CCActionInterval   shaky   = CCShakyTiles3D.actionWithRange(4, false, new ccGridSize(15, 10), 5);
            CCActionInterval   shuffle = CCShuffleTiles.actionWithSeed(0, new ccGridSize(15, 10), 3);
            CCActionInterval   turnoff = CCTurnOffTiles.actionWithSeed(0, new ccGridSize(15, 10), 3);
            CCFiniteTimeAction turnon  = turnoff.reverse();

            // reuse 2 times:
            //   1 for shuffle
            //   2 for turn off
            //   turnon tiles will use a new grid
            CCFiniteTimeAction reuse = CCReuseGrid.actionWithTimes(2);

            CCActionInterval delay = CCDelayTime.actionWithDuration(1);

            //	id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90];
            //	id orbit_back = [orbit reverse];
            //
            //	[target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
            target.runAction((CCActionInterval)(CCSequence.actions(shaky, delay, reuse, shuffle, delay, turnoff, turnon)));
        }
        public new static CCActionInterval actionWithDuration(float t)
        {
            CCFadeOutTRTiles   fadeout = CCFadeOutTRTiles.actionWithSize(new ccGridSize(16, 12), t);
            CCFiniteTimeAction back    = fadeout.reverse();
            CCDelayTime        delay   = CCDelayTime.actionWithDuration(0.5f);

            return((CCActionInterval)(CCSequence.actions(fadeout, delay, back)));
        }
예제 #4
0
        public new static CCActionInterval actionWithDuration(float t)
        {
            CCShuffleTiles     shuffle      = CCShuffleTiles.actionWithSeed(25, new ccGridSize(16, 12), t);
            CCFiniteTimeAction shuffle_back = shuffle.reverse();
            CCDelayTime        delay        = CCDelayTime.actionWithDuration(2);

            return((CCActionInterval)(CCSequence.actions(shuffle, delay, shuffle_back)));
        }
예제 #5
0
        public new static CCActionInterval actionWithDuration(float t)
        {
            CCFlipX3D          flipx      = CCFlipX3D.actionWithDuration(t);
            CCFiniteTimeAction flipx_back = flipx.reverse();
            CCDelayTime        delay      = CCDelayTime.actionWithDuration(2);

            return((CCActionInterval)(CCSequence.actions(flipx, delay, flipx_back)));
        }
예제 #6
0
        public override void onEnter()
        {
            base.onEnter();

            alignSpritesLeft(1);

            CCActionInterval   move   = CCMoveBy.actionWithDuration(1, new CCPoint(150, 0));
            CCFiniteTimeAction action = CCSequence.actions(move, CCDelayTime.actionWithDuration(2), move);

            m_grossini.runAction(action);
        }
예제 #7
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(1);

            CCFiniteTimeAction action = CCSequence.actions(
                CCDelayTime.actionWithDuration(1),
                CCCallFuncN.actionWithTarget(this, new SEL_CallFuncN(repeatForever)));

            m_grossini.runAction(action);
        }
예제 #8
0
        public override void onEnter()
        {
            base.onEnter();

            this.isTouchEnabled = true;

            CCSize       s     = CCDirector.sharedDirector().getWinSize();
            CCLayerColor layer = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(0xFF, 0x00, 0x00, 0x80), s.width * 0.75f, s.height * 0.75f);

            layer.isRelativeAnchorPoint = true;
            layer.position = (new CCPoint(s.width / 2, s.height / 2));
            addChild(layer, 1, kTagLayer);
            //
            // Add two labels using BM label class
            // CCLabelBMFont
            CCLabelBMFont label1 = CCLabelBMFont.labelWithString("LABEL1", "fonts/fnt/konqa32");

            layer.addChild(label1);
            label1.position = new CCPoint(layer.contentSize.width / 2, layer.contentSize.height * 0.75f);
            CCLabelBMFont label2 = CCLabelBMFont.labelWithString("LABEL2", "fonts/fnt/konqa32");

            layer.addChild(label2);
            label2.position = new CCPoint(layer.contentSize.width / 2, layer.contentSize.height * 0.25f);
            //
            // Do the sequence of actions in the bug report
            float waitTime = 3f;
            float runTime  = 12f;

            layer.visible = false;
            CCHide      hide     = CCHide.action();
            CCScaleTo   scaleTo1 = CCScaleTo.actionWithDuration(0.0f, 0.0f);
            CCShow      show     = CCShow.action();
            CCDelayTime delay    = CCDelayTime.actionWithDuration(waitTime);
            CCScaleTo   scaleTo2 = CCScaleTo.actionWithDuration(runTime * 0.25f, 1.2f);
            CCScaleTo   scaleTo3 = CCScaleTo.actionWithDuration(runTime * 0.25f, 0.95f);
            CCScaleTo   scaleTo4 = CCScaleTo.actionWithDuration(runTime * 0.25f, 1.1f);
            CCScaleTo   scaleTo5 = CCScaleTo.actionWithDuration(runTime * 0.25f, 1.0f);

            CCFiniteTimeAction seq = CCSequence.actions(hide, scaleTo1, show, delay, scaleTo2, scaleTo3, scaleTo4, scaleTo5);

            layer.runAction(seq);
        }
예제 #9
0
        public override void onEnter()
        {
            base.onEnter();

            //CCDirector::sharedDirector()->setProjection(CCDirectorProjection2D);

            CCActionInterval effect = CCLiquid.actionWithWaves(1, 20, new ccGridSize(32, 24), 2);

            CCActionInterval stopEffect = (CCActionInterval)(CCSequence.actions(
                                                                 effect,
                                                                 CCDelayTime.actionWithDuration(2),
                                                                 CCStopGrid.action()
                                                                 //					 [DelayTime::actionWithDuration:2],
                                                                 //					 [[effect copy] autorelease],
                                                                 ));

            CCNode bg = getChildByTag(EffectAdvanceScene.kTagBackground);

            bg.runAction(stopEffect);
        }
예제 #10
0
        public override void onEnter()
        {
            base.onEnter();

            CCSprite child = CCSprite.spriteWithFile(s_pPathGrossini);

            child.position = (new CCPoint(200, 200));
            addChild(child, 1);

            //Sum of all action's duration is 1.5 second.
            child.runAction(CCRotateBy.actionWithDuration(1.5f, 90));
            child.runAction(CCSequence.actions(
                                CCDelayTime.actionWithDuration(1.4f),
                                CCFadeOut.actionWithDuration(1.1f))
                            );

            //After 1.5 second, self will be removed.
            runAction(CCSequence.actions(
                          CCDelayTime.actionWithDuration(1.4f),
                          CCCallFunc.actionWithTarget(this, (removeThis)))
                      );
        }
예제 #11
0
        public override void onEnter()
        {
            base.onEnter();

            CCNode target = getChildByTag(EffectAdvanceScene.kTagBackground);

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     Lens3D is Grid3D and it's size is (15,10)
            //     Waves3D is Grid3D and it's size is (15,10)

            CCSize           size  = CCDirector.sharedDirector().getWinSize();
            CCActionInterval lens  = CCLens3D.actionWithPosition(new CCPoint(size.width / 2, size.height / 2), 240, new ccGridSize(15, 10), 0.0f);
            CCActionInterval waves = CCWaves3D.actionWithWaves(18, 15, new ccGridSize(15, 10), 10);

            CCFiniteTimeAction reuse = CCReuseGrid.actionWithTimes(1);
            CCActionInterval   delay = CCDelayTime.actionWithDuration(8);

            CCActionInterval   orbit      = CCOrbitCamera.actionWithDuration(5, 1, 2, 0, 180, 0, -90);
            CCFiniteTimeAction orbit_back = orbit.reverse();

            target.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(orbit, orbit_back))));
            target.runAction(CCSequence.actions(lens, delay, reuse, waves));
        }
        public SpriteBatchNodeOffsetAnchorFlip()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            for (int i = 0; i < 3; i++)
            {
                CCSpriteFrameCache cache = CCSpriteFrameCache.sharedSpriteFrameCache();
                cache.addSpriteFramesWithFile("animations/grossini");
                cache.addSpriteFramesWithFile("animations/grossini_gray", "animations/images/grossini_gray");

                //
                // Animation using Sprite batch
                //
                CCSprite sprite = CCSprite.spriteWithSpriteFrameName("grossini_dance_01.png");
                sprite.position = (new CCPoint(s.width / 4 * (i + 1), s.height / 2));

                CCSprite point = CCSprite.spriteWithFile("Images/r1");
                point.scale    = 0.25f;
                point.position = sprite.position;
                addChild(point, 200);

                switch (i)
                {
                case 0:
                    sprite.anchorPoint = new CCPoint(0, 0);
                    break;

                case 1:
                    sprite.anchorPoint = new CCPoint(0.5f, 0.5f);
                    break;

                case 2:
                    sprite.anchorPoint = (new CCPoint(1, 1));
                    break;
                }

                point.position = sprite.position;

                CCSpriteBatchNode spritebatch = CCSpriteBatchNode.batchNodeWithFile("animations/images/grossini");
                addChild(spritebatch);

                List <CCSpriteFrame> animFrames = new List <CCSpriteFrame>();
                string tmp = "";
                for (int j = 0; j < 14; j++)
                {
                    string temp = "";
                    if (i + 1 < 10)
                    {
                        temp = "0" + (i + 1);
                    }
                    else
                    {
                        temp = (i + 1).ToString();
                    }
                    tmp = string.Format("grossini_dance_{0}.png", temp);
                    CCSpriteFrame frame = cache.spriteFrameByName(tmp);
                    animFrames.Add(frame);
                }

                CCAnimation animation = CCAnimation.animationWithFrames(animFrames);
                sprite.runAction(CCRepeatForever.actionWithAction(CCAnimate.actionWithDuration(2.8f, animation, false)));

                animFrames = null;

                CCFlipY            flip      = CCFlipY.actionWithFlipY(true);
                CCFlipY            flip_back = CCFlipY.actionWithFlipY(false);
                CCDelayTime        delay     = CCDelayTime.actionWithDuration(1);
                CCFiniteTimeAction seq       = CCSequence.actions((CCFiniteTimeAction)delay, (CCFiniteTimeAction)flip, (CCFiniteTimeAction)delay.copyWithZone(null), (CCFiniteTimeAction)flip_back);
                sprite.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq));

                spritebatch.addChild(sprite, i);
            }
        }