コード例 #1
0
        public SpriteBatchNodeColorOpacity()
        {
            // Small capacity. Testing resizing.
            // Don't use capacity=1 in your real game. It is expensive to resize the capacity
            CCSpriteBatchNode batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 1);
            AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);

            sprite1 = new CCSprite(batch.Texture, new CCRect(85 * 0, 121 * 1, 85, 121));
            sprite2 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
            sprite3 = new CCSprite(batch.Texture, new CCRect(85 * 2, 121 * 1, 85, 121));
            sprite4 = new CCSprite(batch.Texture, new CCRect(85 * 3, 121 * 1, 85, 121));

            sprite5 = new CCSprite(batch.Texture, new CCRect(85 * 0, 121 * 1, 85, 121));
            sprite6 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
            sprite7 = new CCSprite(batch.Texture, new CCRect(85 * 2, 121 * 1, 85, 121));
            sprite8 = new CCSprite(batch.Texture, new CCRect(85 * 3, 121 * 1, 85, 121));


            CCFiniteTimeAction action = new CCFadeIn  (2);
            CCFiniteTimeAction action_back = (CCFiniteTimeAction)action.Reverse();
            fade = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(action, action_back)));

            CCFiniteTimeAction tintred = new CCTintBy (2, 0, -255, -255);
            CCFiniteTimeAction tintred_back = (CCFiniteTimeAction)tintred.Reverse();
            red = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(tintred, tintred_back)));

            CCFiniteTimeAction tintgreen = new CCTintBy (2, -255, 0, -255);
            CCFiniteTimeAction tintgreen_back = (CCFiniteTimeAction)tintgreen.Reverse();
            green = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(tintgreen, tintgreen_back)));

            CCFiniteTimeAction tintblue = new CCTintBy (2, -255, -255, 0);
            CCFiniteTimeAction tintblue_back = (CCFiniteTimeAction)tintblue.Reverse();
            blue = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(tintblue, tintblue_back)));

            batch.AddChild(sprite1, 0, (int)kTagSprite.kTagSprite1);
            batch.AddChild(sprite2, 0, (int)kTagSprite.kTagSprite2);
            batch.AddChild(sprite3, 0, (int)kTagSprite.kTagSprite3);
            batch.AddChild(sprite4, 0, (int)kTagSprite.kTagSprite4);
            batch.AddChild(sprite5, 0, (int)kTagSprite.kTagSprite5);
            batch.AddChild(sprite6, 0, (int)kTagSprite.kTagSprite6);
            batch.AddChild(sprite7, 0, (int)kTagSprite.kTagSprite7);
            batch.AddChild(sprite8, 0, (int)kTagSprite.kTagSprite8);
        }
コード例 #2
0
        public SpriteColorOpacity()
        {
            sprite1 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121));
            sprite2 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121));
            sprite3 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 2, 121 * 1, 85, 121));
            sprite4 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 3, 121 * 1, 85, 121));

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

            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);


            CCFiniteTimeAction action = new CCFadeIn  (2);
            CCFiniteTimeAction action_back = (CCFiniteTimeAction)action.Reverse();
            fade = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(action, action_back)));

            CCFiniteTimeAction tintred = new CCTintBy (2, 0, -255, -255);
            CCFiniteTimeAction tintred_back = (CCFiniteTimeAction)tintred.Reverse();
            red = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(tintred, tintred_back)));

            CCFiniteTimeAction tintgreen = new CCTintBy (2, -255, 0, -255);
            CCFiniteTimeAction tintgreen_back = (CCFiniteTimeAction)tintgreen.Reverse();
            green = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(tintgreen, tintgreen_back)));

            CCFiniteTimeAction tintblue = new CCTintBy (2, -255, -255, 0);
            CCFiniteTimeAction tintblue_back = (CCFiniteTimeAction)tintblue.Reverse();
            blue = new CCRepeatForever ((CCFiniteTimeAction)(new CCSequence(tintblue, tintblue_back)));
        }
コード例 #3
0
ファイル: ActionsTest.cs プロジェクト: KerwinMa/CocosSharp
        public ActionFade()
        {
            action1 = new CCFadeIn(1.0f);
            action1Back = action1.Reverse();

            action2 = new CCFadeOut(1.0f);
            action2Back = action2.Reverse();
        }