Beispiel #1
0
        private void DisplayHint()
        {
            _isDisplayingHint = true;

            var idx = FindMove();
            var x   = idx % Constants.KBoardWidth;
            var y   = (int)Math.Floor((double)idx / Constants.KBoardWidth);

            var connected = FindConnectedGems(x, y);

            for (var i = 0; i < connected.Count; i++)
            {
                idx = connected[i];
                x   = idx % Constants.KBoardWidth;
                y   = (int)Math.Floor((double)idx / Constants.KBoardWidth);

                var actionFadeIn  = new CCFadeIn(0.5f);
                var actionFadeOut = new CCFadeOut(0.5f);
                var actionSeq     = new CCSequence(actionFadeIn, actionFadeOut);
                var action        = new CCRepeatForever(actionSeq);

                var hintSprite = new CCSprite("crystalscrystals/hint.png");
                hintSprite.Opacity     = 0;
                hintSprite.Position    = new CCPoint(_fieldPositionZero.X + x * Constants.KGemSize, _fieldPositionZero.Y + y * Constants.KGemSize);
                hintSprite.AnchorPoint = CCPoint.Zero;
                _hintLayer.AddChild(hintSprite);
                hintSprite.RunAction(action);
            }
        }
        public TMXReadWriteTest()
        {
            m_gid = 0;

            CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/orthogonal-test2");

            addChild(map, 0, TileMapTestScene.kTagTileMap);

            CCSize s = map.contentSize;
            ////----UXLOG("ContentSize: %f, %f", s.width,s.height);


            CCTMXLayer layer = map.layerNamed("Layer 0");

            layer.Texture.setAntiAliasTexParameters();

            map.scale = 1;

            CCSprite tile0 = layer.tileAt(new CCPoint(1, 63));
            CCSprite tile1 = layer.tileAt(new CCPoint(2, 63));
            CCSprite tile2 = layer.tileAt(new CCPoint(3, 62));//ccp(1,62));
            CCSprite tile3 = layer.tileAt(new CCPoint(2, 62));

            tile0.anchorPoint = new CCPoint(0.5f, 0.5f);
            tile1.anchorPoint = new CCPoint(0.5f, 0.5f);
            tile2.anchorPoint = new CCPoint(0.5f, 0.5f);
            tile3.anchorPoint = new CCPoint(0.5f, 0.5f);

            CCActionInterval   move      = CCMoveBy.actionWithDuration(0.5f, new CCPoint(0, 160));
            CCActionInterval   rotate    = CCRotateBy.actionWithDuration(2, 360);
            CCActionInterval   scale     = CCScaleBy.actionWithDuration(2, 5);
            CCActionInterval   opacity   = CCFadeOut.actionWithDuration(2);
            CCActionInterval   fadein    = CCFadeIn.actionWithDuration(2);
            CCActionInterval   scaleback = CCScaleTo.actionWithDuration(1, 1);
            CCActionInstant    finish    = CCCallFuncN.actionWithTarget(this, removeSprite);
            CCFiniteTimeAction seq0      = CCSequence.actions(move, rotate, scale, opacity, fadein, scaleback, finish);
            CCActionInterval   seq1      = (CCActionInterval)(seq0.copy());
            CCActionInterval   seq2      = (CCActionInterval)(seq0.copy());
            CCActionInterval   seq3      = (CCActionInterval)(seq0.copy());

            tile0.runAction(seq0);
            tile1.runAction(seq1);
            tile2.runAction(seq2);
            tile3.runAction(seq3);


            m_gid = layer.tileGIDAt(new CCPoint(0, 63));
            ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid);

            schedule(updateCol, 2.0f);
            schedule(repaintWithGID, 2.0f);
            schedule(removeTiles, 1.0f);

            ////----UXLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads());
            ////----UXLOG("++++children: %d", layer->getChildren()->count() );

            m_gid2 = 0;
        }
Beispiel #3
0
        public SpriteColorOpacity()
        {
            CCSprite sprite1 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121));
            CCSprite sprite2 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121));
            CCSprite sprite3 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 2, 121 * 1, 85, 121));
            CCSprite sprite4 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 3, 121 * 1, 85, 121));

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

            CCSize s = CCDirector.SharedDirector.WinSize;

            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      = new CCFadeIn(2);
            CCActionInterval action_back = (CCActionInterval)action.Reverse();
            CCAction         fade        = new CCRepeatForever((CCActionInterval)(CCSequence.FromActions(action, action_back)));

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

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

            CCActionInterval tintblue      = new CCTintBy(2, -255, -255, 0);
            CCActionInterval tintblue_back = (CCActionInterval)tintblue.Reverse();
            CCAction         blue          = new CCRepeatForever((CCActionInterval)(CCSequence.FromActions(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);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public Atlas4()
        {
            m_time = 0;

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

            AddChild(label);

            CCSize s = CCDirector.SharedDirector.WinSize;

            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    = new CCRotateBy(2, 360);
            CCAction         rot_4ever = new CCRepeatForever(rotate);

            CCActionInterval   scale       = new CCScaleBy(2, 1.5f);
            CCFiniteTimeAction scale_back  = scale.Reverse();
            CCFiniteTimeAction scale_seq   = new CCSequence(scale, scale_back);
            CCAction           scale_4ever = new CCRepeatForever((CCActionInterval)scale_seq);

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

            CCActionInterval   fade_out   = new CCFadeOut(1);
            CCActionInterval   fade_in    = new CCFadeIn(1);
            CCFiniteTimeAction seq        = new CCSequence(fade_out, fade_in);
            CCAction           fade_4ever = new CCRepeatForever((CCActionInterval)seq);

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


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

            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);
        }
Beispiel #6
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);
        }
Beispiel #7
0
        public TMXReadWriteTest()
        {
            m_gid = 0;

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test2");

            AddChild(map, 0, kTagTileMap);

            CCTMXLayer layer = map.LayerNamed("Layer 0");

            layer.IsAntialiased = true;

            map.Scale = (1);

            CCSprite tile0 = layer.TileAt(new CCPoint(1, 63));
            CCSprite tile1 = layer.TileAt(new CCPoint(2, 63));
            CCSprite tile2 = layer.TileAt(new CCPoint(3, 62)); //new CCPoint(1,62));
            CCSprite tile3 = layer.TileAt(new CCPoint(2, 62));

            tile0.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile1.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile2.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile3.AnchorPoint = (new CCPoint(0.5f, 0.5f));

            CCMoveBy    move      = new CCMoveBy(0.5f, new CCPoint(0, 160));
            CCRotateBy  rotate    = new CCRotateBy(2, 360);
            CCScaleBy   scale     = new CCScaleBy(2, 5);
            CCFadeOut   opacity   = new CCFadeOut(2);
            CCFadeIn    fadein    = new CCFadeIn(2);
            CCScaleTo   scaleback = new CCScaleTo(1, 1);
            CCCallFuncN finish    = new CCCallFuncN(removeSprite);
            CCSequence  sequence  = new CCSequence(move, rotate, scale, opacity, fadein, scaleback, finish);

            tile0.RunAction(sequence);
            tile1.RunAction(sequence);
            tile2.RunAction(sequence);
            tile3.RunAction(sequence);


            m_gid = layer.TileGIDAt(new CCPoint(0, 63));
            ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid);

            Schedule(updateCol, 2.0f);
            Schedule(repaintWithGID, 2.0f);
            Schedule(removeTiles, 1.0f);

            ////----UXLOG("++++atlas quantity: %d", layer.textureAtlas().getTotalQuads());
            ////----UXLOG("++++children: %d", layer.getChildren().count() );

            m_gid2 = 0;
        }
Beispiel #8
0
        void LoadStartLabels()
        {
            var bounds = mainLayer.VisibleBoundsWorldspace;
            var center = bounds.Center;

            var scaleAction = new CCScaleBy(0.5f, 1.0f, 1.5f);
            var fadeAction  = new CCFadeIn(0.5f);

            scaleLabelAction = new CCSequence(new CCSpawn(scaleAction, fadeAction),
                                              new CCEaseElasticInOut(scaleAction.Reverse(), 1.0f));

            tintLabelAction = new CCSequence(new CCTintTo(1.0f, 100, 152, 219),
                                             new CCTintTo(1.0f, 255, 255, 255));
        }
Beispiel #9
0
        public Atlas4()
        {
            m_time = 0;

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

            label.AnchorPoint = CCPoint.AnchorMiddle;


            var BChar = (CCSprite)label[0];
            var FChar = (CCSprite)label[7];
            var AChar = (CCSprite)label[12];


            var rotate    = new CCRotateBy(2, 360);
            var rot_4ever = new CCRepeatForever(rotate);

            var scale       = new CCScaleBy(2, 1.5f);
            var scale_back  = scale.Reverse();
            var scale_seq   = new CCSequence(scale, scale_back);
            var scale_4ever = new CCRepeatForever(scale_seq);

            var jump       = new CCJumpBy(0.5f, new CCPoint(), 60, 1);
            var jump_4ever = new CCRepeatForever(jump);

            var fade_out   = new CCFadeOut(1);
            var fade_in    = new CCFadeIn(1);
            var seq        = new CCSequence(fade_out, fade_in);
            var fade_4ever = new CCRepeatForever(seq);

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


            // Bottom Label
            label2 = new CCLabelBMFont("00.0", "fonts/bitmapFontTest.fnt");
            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

            var lastChar = (CCSprite)label2[3];

            lastChar.RunAction(rot_4ever);

            //schedule( schedule_selector(Atlas4::step), 0.1f);
            base.Schedule(step, 0.1f);
        }
        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);
        }
Beispiel #11
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            m_tamara.Opacity = 0;
            var action1     = new CCFadeIn(1.0f);
            var action1Back = action1.Reverse();

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

            m_tamara.RunAction(CCSequence.FromActions(action1, action1Back));
            m_kathia.RunAction(CCSequence.FromActions(action2, action2Back));
        }
Beispiel #12
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));
        }
Beispiel #13
0
        public LabelTTFA8Test()
        {
            var layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255));

            AddChild(layer, -10);

            // CCLabelBMFont
            label1 = new CCLabelTtf("Testing A8 Format", "MarkerFelt", 38);
            AddChild(label1);
            label1.Color = CCColor3B.Red;


            var fadeOut = new CCFadeOut(2);
            var fadeIn  = new CCFadeIn(2);

            label1.RepeatForever(fadeIn, fadeOut);
        }
Beispiel #14
0
        public TMXReadWriteTest() : base("TileMaps/orthogonal-test2")
        {
            m_gid = CCTileGidAndFlags.EmptyTile;

            CCTileMapLayer layer = tileMap.LayerNamed("Layer 0");

            layer.Antialiased = true;

            tileMap.Scale = (1);

            CCSprite tile0 = layer.ExtractTile(1, 63);
            CCSprite tile1 = layer.ExtractTile(2, 63);
            CCSprite tile2 = layer.ExtractTile(3, 62); //new CCPoint(1,62));
            CCSprite tile3 = layer.ExtractTile(2, 62);

            tile0.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile1.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile2.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile3.AnchorPoint = (new CCPoint(0.5f, 0.5f));

            CCMoveBy    move      = new CCMoveBy(0.5f, new CCPoint(0, 160));
            CCRotateBy  rotate    = new CCRotateBy(2, 360);
            CCScaleBy   scale     = new CCScaleBy(2, 5);
            CCFadeOut   opacity   = new CCFadeOut(2);
            CCFadeIn    fadein    = new CCFadeIn(2);
            CCScaleTo   scaleback = new CCScaleTo(1, 1);
            CCCallFuncN finish    = new CCCallFuncN(removeSprite);
            CCSequence  sequence  = new CCSequence(move, rotate, scale, opacity, fadein, scaleback, finish);

            tile0.RunAction(sequence);
            tile1.RunAction(sequence);
            tile2.RunAction(sequence);
            tile3.RunAction(sequence);


            m_gid = layer.TileGIDAndFlags(0, 63);

            Schedule(updateCol, 2.0f);
            Schedule(repaintWithGID, 2.0f);
            Schedule(removeTiles, 1.0f);


            m_gid2 = CCTileGidAndFlags.EmptyTile;
        }
        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)));
        }
Beispiel #16
0
        public MainLayer()
        {
            base.isTouchEnabled = true;

            CCSprite sprite = CCSprite.spriteWithFile(ClickAndMoveTest.s_pPathGrossini);

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

            addChild(layer, -1);

            addChild(sprite, 0, ClickAndMoveTest.kTagSprite);
            sprite.position = new CCPoint(20, 150);

            sprite.runAction(CCJumpTo.actionWithDuration(4, new CCPoint(300, 48), 100, 4));

            layer.runAction(CCRepeatForever.actionWithAction(
                                (CCActionInterval)(CCSequence.actions(
                                                       CCFadeIn.actionWithDuration(1),
                                                       CCFadeOut.actionWithDuration(1)))
                                ));
        }
Beispiel #17
0
        public LabelTTFA8Test()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255));

            AddChild(layer, -10);

            // CCLabelBMFont
            CCLabelTTF label1 = new CCLabelTTF("Testing A8 Format", "Marker Felt", 38);

            AddChild(label1);
            label1.Color    = CCTypes.CCRed;
            label1.Position = new CCPoint(s.Width / 2, s.Height / 2);

            CCFadeOut          fadeOut = new CCFadeOut(2);
            CCFadeIn           fadeIn  = new CCFadeIn(2);
            CCFiniteTimeAction seq     = CCSequence.FromActions(fadeOut, fadeIn);
            CCRepeatForever    forever = new CCRepeatForever((CCActionInterval)seq);

            label1.RunAction(forever);
        }
Beispiel #18
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);

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

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


            CCSize s = CCDirector.SharedDirector.WinSize;

            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      = new CCFadeIn(2);
            CCActionInterval action_back = (CCActionInterval)action.Reverse();
            CCAction         fade        = new CCRepeatForever((CCActionInterval)(new CCSequence(action, action_back)));

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

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

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


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

            // late add: test dirtyColor and dirtyPosition
            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);


            Schedule(removeAndAddSprite, 2);
        }
Beispiel #19
0
 public CCFadeInState (CCFadeIn action, CCNode target)
     : base (action, target)
 {
 }
Beispiel #20
0
 protected CCFadeIn (CCFadeIn fadeIn) : base (fadeIn) 
 { }
Beispiel #21
0
 public CCFadeInState(CCFadeIn action, CCNode target)
     : base(action, target)
 {
 }
Beispiel #22
0
 protected CCFadeIn(CCFadeIn fadeIn) : base(fadeIn)
 {
 }