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

            CCActionInterval move      = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0));
            CCActionInterval move_back = (CCActionInterval)move.reverse();

            CCActionInterval move_ease_in      = CCEaseIn.actionWithAction(move.copy() as CCActionInterval, 3);
            CCActionInterval move_ease_in_back = move_ease_in.reverse() as CCActionInterval;

            CCActionInterval move_ease_out      = CCEaseOut.actionWithAction(move.copy() as CCActionInterval, 3);
            CCActionInterval move_ease_out_back = move_ease_out.reverse() as CCActionInterval;

            CCFiniteTimeAction seq1 = CCSequence.actions(move, move_back);

            CCFiniteTimeAction seq2 = CCSequence.actions(move_ease_in, move_ease_in_back);
            CCFiniteTimeAction seq3 = CCSequence.actions(move_ease_out, move_ease_out_back);

            CCAction a2 = m_grossini.runAction(CCRepeatForever.actionWithAction(seq1 as CCActionInterval));

            a2.tag = 1;

            CCAction a1 = m_tamara.runAction(CCRepeatForever.actionWithAction(seq2 as CCActionInterval));

            a1.tag = 1;
            CCAction a = m_kathia.runAction(CCRepeatForever.actionWithAction(seq3 as CCActionInterval));

            a.tag = 1;

            schedule(new SEL_SCHEDULE(testStopAction), 6.0f);
        }
예제 #2
0
        public override void onEnter()
        {
            base.onEnter();

            // rotate and jump
            CCActionInterval jump1 = CCJumpBy.actionWithDuration(4, new CCPoint(-400, 0), 100, 4);
            CCActionInterval jump2 = (CCActionInterval)jump1.reverse();
            CCActionInterval rot1  = CCRotateBy.actionWithDuration(4, 360 * 2);
            CCActionInterval rot2  = (CCActionInterval)rot1.reverse();

            CCFiniteTimeAction seq3_1 = CCSequence.actions(jump2, jump1);
            CCFiniteTimeAction seq3_2 = CCSequence.actions(rot1, rot2);
            CCFiniteTimeAction spawn  = CCSpawn.actions(seq3_1, seq3_2);
            CCSpeed            action = CCSpeed.actionWithAction(CCRepeatForever.actionWithAction((CCActionInterval)spawn), 1.0f);


            action.tag = EaseTest.kTagAction1;

            CCAction action2 = (CCAction)(action.copy());
            CCAction action3 = (CCAction)(action.copy());

            action2.tag = EaseTest.kTagAction1;
            action3.tag = EaseTest.kTagAction1;

            m_grossini.runAction(action2);
            //m_grossini.runAction(CCRepeat.actionWithAction(CCSequence.actions(jump2, jump1), 5));
            m_tamara.runAction(action3);
            m_kathia.runAction(action);

            this.schedule(new SEL_SCHEDULE(altertime), 1.0f);//:@selector(altertime:) interval:1.0f];
        }
예제 #3
0
        public override void onEnter()
        {
            base.onEnter();

            // rotate and jump
            CCActionInterval jump1 = CCJumpBy.actionWithDuration(4, new CCPoint(-400, 0), 100, 4);
            CCActionInterval jump2 = jump1.reverse() as CCActionInterval;
            CCActionInterval rot1  = CCRotateBy.actionWithDuration(4, 360 * 2);
            CCActionInterval rot2  = rot1.reverse() as CCActionInterval;

            CCFiniteTimeAction seq3_1 = CCSequence.actions(jump2, jump1);
            CCFiniteTimeAction seq3_2 = CCSequence.actions(rot1, rot2);
            CCFiniteTimeAction spawn  = CCSpawn.actions(seq3_1, seq3_2);
            CCFiniteTimeAction action = CCRepeatForever.actionWithAction((CCActionInterval)spawn);

            CCRepeatForever action2 = (CCRepeatForever)(action.copy());
            CCRepeatForever action3 = (CCRepeatForever)(action.copy());


            m_grossini.runAction(CCSpeed.actionWithAction((CCActionInterval)action, 0.5f));
            m_tamara.runAction(CCSpeed.actionWithAction((CCActionInterval)action2, 1.5f));
            m_kathia.runAction(CCSpeed.actionWithAction((CCActionInterval)action3, 1.0f));

            CCParticleSystem emitter = CCParticleFireworks.node();

            emitter.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire");
            addChild(emitter);
        }
예제 #4
0
        public TMXIsoZorder()
        {
            CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/iso-test-zorder");

            addChild(map, 0, 1);

            CCSize s = map.contentSize;

            ////----UXLOG("ContentSize: %f, %f", s.width,s.height);
            map.position = (new CCPoint(-s.width / 2, 0));

            m_tamara = CCSprite.spriteWithFile(s_pPathSister1);
            map.addChild(m_tamara, map.children.Count);
            int mapWidth = (int)(map.MapSize.width * map.TileSize.width);

            m_tamara.positionInPixels = new CCPoint(mapWidth / 2, 0);
            m_tamara.anchorPoint      = new CCPoint(0.5f, 0);


            CCActionInterval   move = CCMoveBy.actionWithDuration(10, new CCPoint(300 * 1 / CCDirector.sharedDirector().ContentScaleFactor, 250 * 1 / CCDirector.sharedDirector().ContentScaleFactor));
            CCActionInterval   back = (CCActionInterval)move.reverse();
            CCFiniteTimeAction seq  = CCSequence.actions(move, back);

            m_tamara.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq));

            schedule((this.repositionSprite));
        }
예제 #5
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval move = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0));


            CCActionInterval move_ease_inout1      = CCEaseInOut.actionWithAction(move.copy() as CCActionInterval, 2.0f);
            CCActionInterval move_ease_inout_back1 = move_ease_inout1.reverse() as CCActionInterval;

            CCActionInterval move_ease_inout2      = CCEaseInOut.actionWithAction(move.copy() as CCActionInterval, 3.0f);
            CCActionInterval move_ease_inout_back2 = move_ease_inout2.reverse() as CCActionInterval;

            CCActionInterval move_ease_inout3      = CCEaseInOut.actionWithAction(move.copy() as CCActionInterval, 4.0f);
            CCActionInterval move_ease_inout_back3 = move_ease_inout3.reverse() as CCActionInterval;


            CCFiniteTimeAction seq1 = CCSequence.actions(move_ease_inout1, move_ease_inout_back1);
            CCFiniteTimeAction seq2 = CCSequence.actions(move_ease_inout2, move_ease_inout_back2);
            CCFiniteTimeAction seq3 = CCSequence.actions(move_ease_inout3, move_ease_inout_back3);

            m_tamara.runAction(CCRepeatForever.actionWithAction(seq1 as CCActionInterval));
            m_kathia.runAction(CCRepeatForever.actionWithAction(seq2 as CCActionInterval));
            m_grossini.runAction(CCRepeatForever.actionWithAction(seq3 as CCActionInterval));
        }
예제 #6
0
        public NodeToWorld()
        {
            //
            // This code tests that nodeToParent works OK:
            //  - It tests different anchor Points
            //  - It tests different children anchor points

            CCSprite back = CCSprite.spriteWithFile(TestResource.s_back3);

            addChild(back, -10);
            back.anchorPoint = (new CCPoint(0, 0));
            CCSize backSize = back.contentSize;

            CCMenuItem item = CCMenuItemImage.itemFromNormalImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect);
            CCMenu     menu = CCMenu.menuWithItems(item);

            menu.alignItemsVertically();
            menu.position = (new CCPoint(backSize.width / 2, backSize.height / 2));
            back.addChild(menu);

            CCActionInterval rot = CCRotateBy.actionWithDuration(5, 360);
            CCAction         fe  = CCRepeatForever.actionWithAction(rot);

            item.runAction(fe);

            CCActionInterval   move      = CCMoveBy.actionWithDuration(3, new CCPoint(200, 0));
            CCActionInterval   move_back = (CCActionInterval)move.reverse();
            CCFiniteTimeAction seq       = CCSequence.actions(move, move_back);
            CCAction           fe2       = CCRepeatForever.actionWithAction((CCActionInterval)seq);

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

            CCSize       s      = CCDirector.sharedDirector().getWinSize();
            CCLayerColor layer1 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(255, 255, 0, 80), 100, 300);

            layer1.position = (new CCPoint(s.width / 3, s.height / 2));
            layer1.isRelativeAnchorPoint = true;
            addChild(layer1, 1);

            CCLayerColor layer2 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(0, 0, 255, 255), 100, 300);

            layer2.position = (new CCPoint((s.width / 3) * 2, s.height / 2));
            layer2.isRelativeAnchorPoint = true;
            addChild(layer2, 1);

            CCActionInterval actionTint     = CCTintBy.actionWithDuration(2, -255, -127, 0);
            CCActionInterval actionTintBack = (CCActionInterval)actionTint.reverse();
            CCActionInterval seq1           = (CCActionInterval)CCSequence.actions(actionTint, actionTintBack);

            layer1.runAction(seq1);

            CCActionInterval actionFade     = CCFadeOut.actionWithDuration(2.0f);
            CCActionInterval actionFadeBack = (CCActionInterval)actionFade.reverse();
            CCActionInterval seq2           = (CCActionInterval)CCSequence.actions(actionFade, actionFadeBack);

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

            m_background.parent.removeChild(m_background, true);
            m_background = null;

            CCParallaxNode p = CCParallaxNode.node();

            addChild(p, 5);

            CCSprite p1 = CCSprite.spriteWithFile(TestResource.s_back3);
            CCSprite p2 = CCSprite.spriteWithFile(TestResource.s_back3);

            p.addChild(p1, 1, new CCPoint(0.5f, 1), new CCPoint(0, 0));
            p.addChild(p2, 2, new CCPoint(1.5f, 1), new CCPoint(0, 0));

            m_emitter = CCParticleFlower.node();

            m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_fire);

            p1.addChild(m_emitter, 10);
            m_emitter.position = new CCPoint(250, 200);

            CCParticleSun par = CCParticleSun.node();

            p2.addChild(par, 10);
            par.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_fire);

            CCActionInterval   move      = CCMoveBy.actionWithDuration(4, new CCPoint(300, 0));
            CCFiniteTimeAction move_back = move.reverse();
            CCFiniteTimeAction seq       = CCSequence.actions(move, move_back);

            p.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq));
        }
        public LabelAtlasColorTest()
        {
            CCLabelAtlas label1 = CCLabelAtlas.labelWithString("123 Test", "fonts/fnt/images/tuffy_bold_italic-charmap", 48, 64, ' ');

            addChild(label1, 0, (int)TagSprite.kTagSprite1);
            label1.position = new CCPoint(10, 100);
            label1.Opacity  = 200;

            CCLabelAtlas label2 = CCLabelAtlas.labelWithString("0123456789", "fonts/fnt/images/tuffy_bold_italic-charmap", 48, 64, ' ');

            addChild(label2, 0, (int)TagSprite.kTagSprite2);
            label2.position = new CCPoint(10, 200);
            label2.Color    = ccRED;

            CCActionInterval   fade    = CCFadeOut.actionWithDuration(1.0f);
            CCFiniteTimeAction fade_in = fade.reverse();
            CCFiniteTimeAction seq     = CCSequence.actions(fade, fade_in);
            CCAction           repeat  = CCRepeatForever.actionWithAction((CCActionInterval)seq);

            label2.runAction(repeat);

            m_time = 0;

            schedule(step); //:@selector(step:)];
        }
        public override void onEnter()
        {
            base.onEnter();

            float x, y;

            CCSize size = CCDirector.sharedDirector().getWinSize();

            x = size.width;
            y = size.height;

            CCSprite bg = CCSprite.spriteWithFile("Images/background3");

            addChild(bg, 0, EffectAdvanceScene.kTagBackground);
            bg.position = new CCPoint(x / 2, y / 2);

            grossini = CCSprite.spriteWithFile("Images/grossinis_sister2");
            bg.addChild(grossini, 1, EffectAdvanceScene.kTagSprite1);
            grossini.position = new CCPoint(x / 3.0f, 200);
            CCActionInterval   sc      = CCScaleBy.actionWithDuration(2, 5);
            CCFiniteTimeAction sc_back = sc.reverse();

            grossini.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(sc, sc_back))));

            tamara = CCSprite.spriteWithFile("Images/grossinis_sister1");
            bg.addChild(tamara, 1, EffectAdvanceScene.kTagSprite2);
            tamara.position = new CCPoint(2 * x / 3.0f, 200);
            CCActionInterval   sc2      = CCScaleBy.actionWithDuration(2, 5);
            CCFiniteTimeAction sc2_back = sc2.reverse();

            tamara.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(sc2, sc2_back))));

            CCLabelTTF label = CCLabelTTF.labelWithString(title(), "Arial", 28);

            label.position = new CCPoint(x / 2, y - 80);
            addChild(label);
            label.tag = EffectAdvanceScene.kTagLabel;

            string strSubtitle = subtitle();

            if (strSubtitle != null)
            {
                CCLabelTTF l = CCLabelTTF.labelWithString(strSubtitle, "Arial", 16);
                addChild(l, 101);
                l.position = new CCPoint(size.width / 2, size.height - 80);
            }

            CCMenuItemImage item1 = CCMenuItemImage.itemFromNormalImage("Images/b1", "Images/b2", this, backCallback);
            CCMenuItemImage item2 = CCMenuItemImage.itemFromNormalImage("Images/r1", "Images/r2", this, restartCallback);
            CCMenuItemImage item3 = CCMenuItemImage.itemFromNormalImage("Images/f1", "Images/f2", this, nextCallback);

            CCMenu menu = CCMenu.menuWithItems(item1, item2, item3);

            menu.position  = new CCPoint(0, 0);
            item1.position = new CCPoint(size.width / 2 - 100, 30);
            item2.position = new CCPoint(size.width / 2, 30);
            item3.position = new CCPoint(size.width / 2 + 100, 30);

            addChild(menu, 1);
        }
예제 #11
0
        public TMXIsoVertexZ()
        {
            CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/iso-test-vertexz");

            addChild(map, 0, 1);

            CCSize s = map.contentSize;

            map.position = new CCPoint(-s.width / 2, 0);
            ////----UXLOG("ContentSize: %f, %f", s.width,s.height);

            // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
            // can use any CCSprite and it will work OK.
            CCTMXLayer layer = map.layerNamed("Trees");

            m_tamara = layer.tileAt(new CCPoint(29, 29));

            CCActionInterval   move = CCMoveBy.actionWithDuration(10, new CCPoint(300 * 1 / CCDirector.sharedDirector().ContentScaleFactor, 250 * 1 / CCDirector.sharedDirector().ContentScaleFactor));
            CCActionInterval   back = (CCActionInterval)move.reverse();
            CCFiniteTimeAction seq  = CCSequence.actions(move, back);

            m_tamara.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq));

            schedule(repositionSprite);
        }
예제 #12
0
        public StressTest2()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCLayer sublayer = CCLayer.node();

            CCSprite sp1 = CCSprite.spriteWithFile(TestResource.s_pPathSister1);

            sp1.position = (new CCPoint(80, s.height / 2));

            CCActionInterval   move                  = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0));
            CCActionInterval   move_ease_inout3      = CCEaseInOut.actionWithAction((CCActionInterval)(move.copy()), 2.0f);
            CCActionInterval   move_ease_inout_back3 = (CCActionInterval)move_ease_inout3.reverse();
            CCFiniteTimeAction seq3                  = CCSequence.actions(move_ease_inout3, move_ease_inout_back3);

            sp1.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq3));
            sublayer.addChild(sp1, 1);

            CCParticleFire fire = CCParticleFire.node();

            fire.Texture  = (CCTextureCache.sharedTextureCache().addImage("Images/fire"));
            fire.position = (new CCPoint(80, s.height / 2 - 50));

            CCActionInterval copy_seq3 = (CCActionInterval)(seq3.copy());

            fire.runAction(CCRepeatForever.actionWithAction(copy_seq3));
            sublayer.addChild(fire, 2);

            schedule((shouldNotLeak), 6.0f);

            addChild(sublayer, 0, CocosNodeTestStaticLibrary.kTagSprite1);
        }
예제 #13
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(1);

            CCAnimation animation = CCAnimation.animation();
            string      frameName;

            for (int i = 1; i < 15; i++)
            {
                if (i < 10)
                {
                    frameName = string.Format("Images/grossini_dance_0{0}", i);
                }
                else
                {
                    frameName = string.Format("Images/grossini_dance_{0}", i);
                }
                animation.addFrameWithFileName(frameName);
            }

            CCActionInterval   action      = CCAnimate.actionWithDuration(3.0f, animation, false);
            CCFiniteTimeAction action_back = action.reverse();

            m_grossini.runAction(CCSequence.actions(action, action_back));
        }
예제 #14
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)));
        }
예제 #15
0
        public override void onEnter()
        {
            base.onEnter();

            alignSpritesLeft(2);


            // Test:
            //   Sequence should work both with IntervalAction and InstantActions
            CCActionInterval   move1  = CCMoveBy.actionWithDuration(1, new CCPoint(250, 0));
            CCActionInterval   move2  = CCMoveBy.actionWithDuration(1, new CCPoint(0, 50));
            CCToggleVisibility tog1   = new CCToggleVisibility();
            CCToggleVisibility tog2   = new CCToggleVisibility();
            CCFiniteTimeAction seq    = CCSequence.actions(move1, tog1, move2, tog2, move1.reverse());
            CCActionInterval   action = CCRepeat.actionWithAction((CCActionInterval)(CCSequence.actions(seq, seq.reverse())), 3);

            // Test:
            //   Also test that the reverse of Hide is Show, and vice-versa
            m_kathia.runAction(action);

            CCActionInterval   move_tamara  = CCMoveBy.actionWithDuration(1, new CCPoint(100, 0));
            CCActionInterval   move_tamara2 = CCMoveBy.actionWithDuration(1, new CCPoint(50, 0));
            CCActionInstant    hide         = new CCHide();
            CCFiniteTimeAction seq_tamara   = CCSequence.actions(move_tamara, hide, move_tamara2);
            CCFiniteTimeAction seq_back     = seq_tamara.reverse();

            m_tamara.runAction(CCSequence.actions(seq_tamara, seq_back));
        }
        public SpriteBatchNodeAliased()
        {
            CCSpriteBatchNode batch = CCSpriteBatchNode.batchNodeWithFile("Images/grossini_dance_atlas", 10);

            addChild(batch, 0, (int)kTags.kTagSpriteBatchNode);

            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCSprite sprite1 = CCSprite.spriteWithTexture(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));

            sprite1.position = (new CCPoint(s.width / 2 - 100, s.height / 2));
            batch.addChild(sprite1, 0, (int)kTagSprite.kTagSprite1);

            CCSprite sprite2 = CCSprite.spriteWithTexture(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));

            sprite2.position = (new CCPoint(s.width / 2 + 100, s.height / 2));
            batch.addChild(sprite2, 0, (int)kTagSprite.kTagSprite2);

            CCActionInterval scale      = CCScaleBy.actionWithDuration(2, 5);
            CCActionInterval scale_back = (CCActionInterval)scale.reverse();
            CCActionInterval seq        = (CCActionInterval)(CCSequence.actions(scale, scale_back));
            CCAction         repeat     = CCRepeatForever.actionWithAction(seq);

            CCAction repeat2 = (CCAction)(repeat.copy());

            sprite1.runAction(repeat);
            sprite2.runAction(repeat2);
        }
예제 #17
0
        public Test6()
        {
            CCSprite sp1  = CCSprite.spriteWithFile(TestResource.s_pPathSister1);
            CCSprite sp11 = CCSprite.spriteWithFile(TestResource.s_pPathSister1);

            CCSprite sp2  = CCSprite.spriteWithFile(TestResource.s_pPathSister2);
            CCSprite sp21 = CCSprite.spriteWithFile(TestResource.s_pPathSister2);

            sp1.position = (new CCPoint(100, 160));
            sp2.position = (new CCPoint(380, 160));

            CCActionInterval rot      = CCRotateBy.actionWithDuration(2, 360);
            CCActionInterval rot_back = rot.reverse() as CCActionInterval;
            CCAction         forever1 = CCRepeatForever.actionWithAction(
                (CCActionInterval)(CCSequence.actions(rot, rot_back)));
            CCAction forever11 = (CCAction)(forever1.copy());

            CCAction forever2  = (CCAction)(forever1.copy());
            CCAction forever21 = (CCAction)(forever1.copy());

            addChild(sp1, 0, CocosNodeTestStaticLibrary.kTagSprite1);
            sp1.addChild(sp11);
            addChild(sp2, 0, CocosNodeTestStaticLibrary.kTagSprite2);
            sp2.addChild(sp21);

            sp1.runAction(forever1);
            sp11.runAction(forever11);
            sp2.runAction(forever2);
            sp21.runAction(forever21);

            schedule(new SEL_SCHEDULE(this.addAndRemove), 2.0f);
        }
예제 #18
0
        public ParticleDemo()
        {
            initWithColor(ccTypes.ccc4(127, 127, 127, 255));

            m_emitter = null;

            isTouchEnabled = true;

            CCSize     s     = CCDirector.sharedDirector().getWinSize();
            CCLabelTTF label = CCLabelTTF.labelWithString(title(), "Arial", 28);

            addChild(label, 100, 1000);
            label.position = new CCPoint(s.width / 2, s.height - 50);

            CCLabelTTF tapScreen = CCLabelTTF.labelWithString("(Tap the Screen)", "Arial", 20);

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

            CCMenuItemImage item1 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathB1, TestResource.s_pPathB2, this, new SEL_MenuHandler(backCallback));
            CCMenuItemImage item2 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathR1, TestResource.s_pPathR2, this, new SEL_MenuHandler(restartCallback));
            CCMenuItemImage item3 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathF1, TestResource.s_pPathF2, this, new SEL_MenuHandler(nextCallback));

            CCMenuItemToggle item4 = CCMenuItemToggle.itemWithTarget(this,
                                                                     new SEL_MenuHandler(toggleCallback),
                                                                     CCMenuItemFont.itemFromString("Free Movement"),
                                                                     CCMenuItemFont.itemFromString("Relative Movement"),
                                                                     CCMenuItemFont.itemFromString("Grouped Movement"));

            CCMenu menu = CCMenu.menuWithItems(item1, item2, item3, item4);

            menu.position     = new CCPoint(0, 0);
            item1.position    = new CCPoint(s.width / 2 - 100, 30);
            item2.position    = new CCPoint(s.width / 2, 30);
            item3.position    = new CCPoint(s.width / 2 + 100, 30);
            item4.position    = new CCPoint(0, 100);
            item4.anchorPoint = new CCPoint(0, 0);

            addChild(menu, 100);

            CCLabelAtlas labelAtlas = CCLabelAtlas.labelWithString("0000", "fonts/fnt/images/fps_images", 16, 24, '.');

            addChild(labelAtlas, 100, ParticleTestScene.kTagLabelAtlas);
            labelAtlas.position = new CCPoint(s.width - 66, 50);

            // moving background
            m_background = CCSprite.spriteWithFile(TestResource.s_back3);
            addChild(m_background, 5);
            m_background.position = new CCPoint(s.width / 2 - 120, s.height - 240);

            CCActionInterval   move      = CCMoveBy.actionWithDuration(4, new CCPoint(300, 0));
            CCFiniteTimeAction move_back = move.reverse();
            CCFiniteTimeAction seq       = CCSequence.actions(move, move_back);

            m_background.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq));


            schedule(new SEL_SCHEDULE(step));
        }
예제 #19
0
        public SpriteColorOpacity()
        {
            CCSprite sprite1 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121));
            CCSprite sprite2 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121));
            CCSprite sprite3 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 2, 121 * 1, 85, 121));
            CCSprite sprite4 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 3, 121 * 1, 85, 121));

            CCSprite sprite5 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121));
            CCSprite sprite6 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121));
            CCSprite sprite7 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 2, 121 * 1, 85, 121));
            CCSprite sprite8 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 3, 121 * 1, 85, 121));

            CCSize s = CCDirector.sharedDirector().getWinSize();

            sprite1.position = new CCPoint((s.width / 5) * 1, (s.height / 3) * 1);
            sprite2.position = new CCPoint((s.width / 5) * 2, (s.height / 3) * 1);
            sprite3.position = new CCPoint((s.width / 5) * 3, (s.height / 3) * 1);
            sprite4.position = new CCPoint((s.width / 5) * 4, (s.height / 3) * 1);
            sprite5.position = new CCPoint((s.width / 5) * 1, (s.height / 3) * 2);
            sprite6.position = new CCPoint((s.width / 5) * 2, (s.height / 3) * 2);
            sprite7.position = new CCPoint((s.width / 5) * 3, (s.height / 3) * 2);
            sprite8.position = new CCPoint((s.width / 5) * 4, (s.height / 3) * 2);

            CCActionInterval action      = CCFadeIn.actionWithDuration(2);
            CCActionInterval action_back = (CCActionInterval)action.reverse();
            CCAction         fade        = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(action, action_back)));

            CCActionInterval tintred      = CCTintBy.actionWithDuration(2, 0, -255, -255);
            CCActionInterval tintred_back = (CCActionInterval)tintred.reverse();
            CCAction         red          = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(tintred, tintred_back)));

            CCActionInterval tintgreen      = CCTintBy.actionWithDuration(2, -255, 0, -255);
            CCActionInterval tintgreen_back = (CCActionInterval)tintgreen.reverse();
            CCAction         green          = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(tintgreen, tintgreen_back)));

            CCActionInterval tintblue      = CCTintBy.actionWithDuration(2, -255, -255, 0);
            CCActionInterval tintblue_back = (CCActionInterval)tintblue.reverse();
            CCAction         blue          = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(tintblue, tintblue_back)));

            sprite5.runAction(red);
            sprite6.runAction(green);
            sprite7.runAction(blue);
            sprite8.runAction(fade);

            // late add: test dirtyColor and dirtyPosition
            addChild(sprite1, 0, (int)kTagSprite.kTagSprite1);
            addChild(sprite2, 0, (int)kTagSprite.kTagSprite2);
            addChild(sprite3, 0, (int)kTagSprite.kTagSprite3);
            addChild(sprite4, 0, (int)kTagSprite.kTagSprite4);
            addChild(sprite5, 0, (int)kTagSprite.kTagSprite5);
            addChild(sprite6, 0, (int)kTagSprite.kTagSprite6);
            addChild(sprite7, 0, (int)kTagSprite.kTagSprite7);
            addChild(sprite8, 0, (int)kTagSprite.kTagSprite8);

            schedule(removeAndAddSprite, 2);
        }
예제 #20
0
        public Atlas4()
        {
            m_time = 0;

            // Upper Label
            CCLabelBMFont label = CCLabelBMFont.labelWithString("Bitmap Font Atlas", "fonts/fnt/bitmapFontTest");

            addChild(label);

            CCSize s = CCDirector.sharedDirector().getWinSize();

            label.position    = new CCPoint(s.width / 2, s.height / 2);
            label.anchorPoint = new CCPoint(0.5f, 0.5f);


            CCSprite BChar = (CCSprite)label.getChildByTag(0);
            CCSprite FChar = (CCSprite)label.getChildByTag(7);
            CCSprite AChar = (CCSprite)label.getChildByTag(12);


            CCActionInterval rotate    = CCRotateBy.actionWithDuration(2, 360);
            CCAction         rot_4ever = CCRepeatForever.actionWithAction(rotate);

            CCActionInterval   scale       = CCScaleBy.actionWithDuration(2, 1.5f);
            CCFiniteTimeAction scale_back  = scale.reverse();
            CCFiniteTimeAction scale_seq   = CCSequence.actions(scale, scale_back);
            CCAction           scale_4ever = CCRepeatForever.actionWithAction((CCActionInterval)scale_seq);

            CCActionInterval jump       = CCJumpBy.actionWithDuration(0.5f, new CCPoint(), 60, 1);
            CCAction         jump_4ever = CCRepeatForever.actionWithAction(jump);

            CCActionInterval   fade_out   = CCFadeOut.actionWithDuration(1);
            CCActionInterval   fade_in    = CCFadeIn.actionWithDuration(1);
            CCFiniteTimeAction seq        = CCSequence.actions(fade_out, fade_in);
            CCAction           fade_4ever = CCRepeatForever.actionWithAction((CCActionInterval)seq);

            BChar.runAction(rot_4ever);
            BChar.runAction(scale_4ever);
            FChar.runAction(jump_4ever);
            AChar.runAction(fade_4ever);


            // Bottom Label
            CCLabelBMFont label2 = CCLabelBMFont.labelWithString("00.0", "fonts/fnt/bitmapFontTest");

            addChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.position = new CCPoint(s.width / 2.0f, 80);

            CCSprite lastChar = (CCSprite)label2.getChildByTag(3);

            lastChar.runAction((CCAction)(rot_4ever.copy()));

            //schedule( schedule_selector(Atlas4::step), 0.1f);
            base.schedule(step, 0.1f);
        }
예제 #21
0
        public override void onEnter()
        {
            base.onEnter();

            alignSpritesLeft(1);

            CCActionInterval   jump   = CCJumpBy.actionWithDuration(2, new CCPoint(300, 0), 50, 4);
            CCFiniteTimeAction action = CCSequence.actions(jump, jump.reverse());

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

            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCSprite sp1 = CCSprite.spriteWithFile(TestResource.s_pPathSister1);
            CCSprite sp2 = CCSprite.spriteWithFile(TestResource.s_pPathSister2);
            CCSprite sp3 = CCSprite.spriteWithFile(TestResource.s_pPathSister1);
            CCSprite sp4 = CCSprite.spriteWithFile(TestResource.s_pPathSister2);

            sp1.position = (new CCPoint(100, s.height / 2));
            sp2.position = (new CCPoint(380, s.height / 2));
            addChild(sp1);
            addChild(sp2);

            sp3.scale = (0.25f);
            sp4.scale = (0.25f);

            sp1.addChild(sp3);
            sp2.addChild(sp4);

            CCActionInterval a1 = CCRotateBy.actionWithDuration(2, 360);
            CCActionInterval a2 = CCScaleBy.actionWithDuration(2, 2);

            CCAction action1 = CCRepeatForever.actionWithAction(
                (CCActionInterval)(CCSequence.actions(a1, a2, a2.reverse()))
                );
            CCAction action2 = CCRepeatForever.actionWithAction(
                (CCActionInterval)(CCSequence.actions(
                                       (CCActionInterval)(a1.copy()),
                                       (CCActionInterval)(a2.copy()),
                                       a2.reverse()))
                );

            sp2.anchorPoint = (new CCPoint(0, 0));

            sp1.runAction(action1);
            sp2.runAction(action2);
        }
예제 #23
0
        public override void onEnter()
        {
            base.onEnter();

            alignSpritesLeft(1);

            CCActionInterval   move1  = CCMoveBy.actionWithDuration(1, new CCPoint(250, 0));
            CCActionInterval   move2  = CCMoveBy.actionWithDuration(1, new CCPoint(0, 50));
            CCFiniteTimeAction seq    = CCSequence.actions(move1, move2, move1.reverse());
            CCFiniteTimeAction action = CCSequence.actions(seq, seq.reverse());

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

            centerSprites(2);

            CCActionInterval   action1     = CCTintTo.actionWithDuration(2, 255, 0, 255);
            CCActionInterval   action2     = CCTintBy.actionWithDuration(2, -127, -255, -127);
            CCFiniteTimeAction action2Back = action2.reverse();

            m_tamara.runAction(action1);
            m_kathia.runAction(CCSequence.actions(action2, action2Back));
        }
예제 #25
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(3);

            CCActionInterval   actionTo     = CCScaleTo.actionWithDuration(2, 0.5f);
            CCActionInterval   actionBy     = CCScaleBy.actionWithDuration(2, 2);
            CCActionInterval   actionBy2    = CCScaleBy.actionWithDuration(2, 0.25f, 4.5f);
            CCFiniteTimeAction actionByBack = actionBy.reverse();

            m_tamara.runAction(actionTo);
            m_grossini.runAction(CCSequence.actions(actionBy, actionByBack));
            m_kathia.runAction(CCSequence.actions(actionBy2, actionBy2.reverse()));
        }
예제 #26
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(3);

            CCActionInterval   actionTo     = CCJumpTo.actionWithDuration(2, new CCPoint(300, 300), 50, 4);
            CCActionInterval   actionBy     = CCJumpBy.actionWithDuration(2, new CCPoint(300, 0), 50, 4);
            CCActionInterval   actionUp     = CCJumpBy.actionWithDuration(2, new CCPoint(0, 0), 80, 4);
            CCFiniteTimeAction actionByBack = actionBy.reverse();

            m_tamara.runAction(actionTo);
            m_grossini.runAction(CCSequence.actions(actionBy, actionByBack));
            m_kathia.runAction(CCRepeatForever.actionWithAction(actionUp));
        }
예제 #27
0
        public Atlas3()
        {
            m_time = 0;

            CCLayerColor col = CCLayerColor.layerWithColor(new ccColor4B(128, 128, 128, 255));

            addChild(col, -10);

            CCLabelBMFont label1 = CCLabelBMFont.labelWithString("Test", "fonts/fnt/bitmapFontTest2");

            // testing anchors
            label1.anchorPoint = new CCPoint(0, 0);
            addChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
            CCActionInterval   fade    = CCFadeOut.actionWithDuration(1.0f);
            CCFiniteTimeAction fade_in = fade.reverse();
            CCFiniteTimeAction seq     = CCSequence.actions(fade, fade_in);
            CCAction           repeat  = CCRepeatForever.actionWithAction((CCActionInterval)seq);

            label1.runAction(repeat);


            // VERY IMPORTANT
            // color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
            // If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
            // Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
            CCLabelBMFont label2 = CCLabelBMFont.labelWithString("Test", "fonts/fnt/bitmapFontTest2");

            // testing anchors
            label2.anchorPoint = new CCPoint(0.5f, 0.5f);
            label2.Color       = ccRED;
            addChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.runAction((CCAction)(repeat.copy()));

            CCLabelBMFont label3 = CCLabelBMFont.labelWithString("Test", "fonts/fnt/bitmapFontTest2");

            // testing anchors
            label3.anchorPoint = new CCPoint(1, 1);
            addChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);


            CCSize s = CCDirector.sharedDirector().getWinSize();

            label1.position = new CCPoint();
            label2.position = new CCPoint(s.width / 2, s.height / 2);
            label3.position = new CCPoint(s.width, s.height);

            base.schedule(step);//:@selector(step:)];
        }
예제 #28
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(2);

            m_tamara.Opacity = 0;
            CCActionInterval   action1     = CCFadeIn.actionWithDuration(1.0f);
            CCFiniteTimeAction action1Back = action1.reverse();

            CCActionInterval   action2     = CCFadeOut.actionWithDuration(1.0f);
            CCFiniteTimeAction action2Back = action2.reverse();

            m_tamara.runAction(CCSequence.actions(action1, action1Back));
            m_kathia.runAction(CCSequence.actions(action2, action2Back));
        }
예제 #29
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(3);

            CCActionInterval   actionTo     = CCSkewTo.actionWithDuration(2, 37.2f, -37.2f);
            CCActionInterval   actionToBack = CCSkewTo.actionWithDuration(2, 0, 0);
            CCActionInterval   actionBy     = CCSkewBy.actionWithDuration(2, 0.0f, -90.0f);
            CCActionInterval   actionBy2    = CCSkewBy.actionWithDuration(2, 45.0f, 45.0f);
            CCFiniteTimeAction actionByBack = actionBy.reverse();

            m_tamara.runAction(CCSequence.actions(actionTo, actionToBack));
            m_grossini.runAction(CCSequence.actions(actionBy, actionByBack));

            m_kathia.runAction(CCSequence.actions(actionBy2, actionBy2.reverse()));
        }
예제 #30
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(1);
            CCSize s = CCDirector.sharedDirector().getWinSize();

            m_grossini.position = new CCPoint(-200, s.height / 2);
            CCActionInterval   move      = CCMoveBy.actionWithDuration(2, new CCPoint(s.width * 3, 0));
            CCFiniteTimeAction move_back = move.reverse();
            CCFiniteTimeAction seq       = CCSequence.actions(move, move_back);
            CCAction           rep       = CCRepeatForever.actionWithAction((CCActionInterval)seq);

            m_grossini.runAction(rep);

            this.runAction(CCFollow.actionWithTarget(m_grossini, new CCRect(0, 0, s.width * 2 - 100, s.height)));
        }