Example #1
0
        public override bool Init()
        {
            if (base.Init())
            {
                CCSize s = CCDirector.SharedDirector.WinSize;

                CCLayerColor background = new CCLayerColor(new CCColor4B(255, 0, 255, 255));
                AddChild(background);

                CCLayerColor sprite_a = new CCLayerColor(new CCColor4B(255, 0, 0, 255), 700, 700);
                sprite_a.AnchorPoint = new CCPoint(0.5f, 0.5f);
                sprite_a.IgnoreAnchorPointForPosition = true;
                sprite_a.Position = new CCPoint(0.0f, s.Height / 2);
                AddChild(sprite_a);

                sprite_a.RunAction(new CCRepeatForever ((CCActionInterval)CCSequence.FromActions(
                                                                       new CCMoveTo (1.0f, new CCPoint(1024.0f, 384.0f)),
                                                                       new CCMoveTo (1.0f, new CCPoint(0.0f, 384.0f)))));

                CCLayerColor sprite_b = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 400, 400);
                sprite_b.AnchorPoint = new CCPoint(0.5f, 0.5f);
                sprite_b.IgnoreAnchorPointForPosition = true;
                sprite_b.Position = new CCPoint(s.Width / 2, s.Height / 2);
                AddChild(sprite_b);

                CCMenuItemLabel label = CCMenuItemLabel.Create(new CCLabelTTF("Flip Me", "Helvetica", 24), callBack);
                CCMenu menu = new CCMenu(label);
                menu.Position = new CCPoint(s.Width - 200.0f, 50.0f);
                AddChild(menu);

                return true;
            }

            return false;
        }
Example #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80), 100, 300);
            layer1.Position = (new CCPoint(s.Width / 3, s.Height / 2));
            layer1.IgnoreAnchorPointForPosition = false;
            AddChild(layer1, 1);

            CCLayerColor layer2 = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 100, 300);
            layer2.Position = (new CCPoint((s.Width / 3) * 2, s.Height / 2));
            layer2.IgnoreAnchorPointForPosition = false;
            AddChild(layer2, 1);

            CCActionInterval actionTint = new CCTintBy (2, -255, -127, 0);
            CCActionInterval actionTintBack = (CCActionInterval)actionTint.Reverse();
            CCActionInterval seq1 = (CCActionInterval)CCSequence.FromActions(actionTint, actionTintBack);
            layer1.RunAction(seq1);

            CCActionInterval actionFade = new CCFadeOut  (2.0f);
            CCActionInterval actionFadeBack = (CCActionInterval)actionFade.Reverse();
            CCActionInterval seq2 = (CCActionInterval)CCSequence.FromActions(actionFade, actionFadeBack);
            layer2.RunAction(seq2);
        }
Example #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCActionInterval effect = (CCSequence.FromActions(new CCDelayTime (2.0f), new CCShaky3D(16, false, new CCGridSize(5, 5), 5.0f)));

            // cleanup
            CCNode bg = GetChildByTag(EffectAdvanceScene.kTagBackground);
            RemoveChild(bg, true);

            // background
            CCLayerColor layer = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
            AddChild(layer, -10);
            CCSprite sprite = new CCSprite("Images/grossini");
            sprite.Position = new CCPoint(50, 80);
            layer.AddChild(sprite, 10);

            // foreground
            CCLayerColor layer2 = new CCLayerColor(new CCColor4B(0, 255, 0, 255));
            CCSprite fog = new CCSprite("Images/Fog");

            var bf = new CCBlendFunc {Source = OGLES.GL_SRC_ALPHA, Destination = OGLES.GL_ONE_MINUS_SRC_ALPHA};
            fog.BlendFunc = bf;
            layer2.AddChild(fog, 1);
            AddChild(layer2, 1);

            layer2.RunAction(new CCRepeatForever (effect));
        }
Example #4
0
        public MainLayer()
        {
            base.TouchEnabled = true;

            CCSprite sprite = new CCSprite(ClickAndMoveTest.s_pPathGrossini);

            CCLayer layer = new CCLayerColor(new CCColor4B(255, 255, 0, 255));
            AddChild(layer, -1);

            AddChild(sprite, 0, ClickAndMoveTest.kTagSprite);
            sprite.Position = new CCPoint(20, 150);

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

            layer.RunAction(new CCRepeatForever (
                                                                (CCActionInterval)(CCSequence.FromActions(
                                                                                    new CCFadeIn  (1),
                                                                                    new CCFadeOut  (1)))
                                                                ));
        }
        public override void OnEnter()
        {
            base.OnEnter();

            float x, y;

            CCSize size = CCDirector.SharedDirector.WinSize;
            x = size.Width;
            y = size.Height;

            CCNode blue = new CCLayerColor(new CCColor4B(0, 0, 255, 255));
            CCNode red = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
            CCNode green = new CCLayerColor(new CCColor4B(0, 255, 0, 255));
            CCNode white = new CCLayerColor(new CCColor4B(255, 255, 255, 255));

            blue.Scale = (0.5f);
            blue.Position = (new CCPoint(-x / 4, -y / 4));
            blue.AddChild(SpriteLayer.node());

            red.Scale = (0.5f);
            red.Position = (new CCPoint(x / 4, -y / 4));

            green.Scale = (0.5f);
            green.Position = (new CCPoint(-x / 4, y / 4));
            green.AddChild(TestLayer.node());

            white.Scale = (0.5f);
            white.Position = (new CCPoint(x / 4, y / 4));

            AddChild(blue, -1);
            AddChild(white);
            AddChild(green);
            AddChild(red);

            CCAction rot = new CCRotateBy (8, 720);

            blue.RunAction(rot);
            red.RunAction((CCAction)(rot.Copy()));
            green.RunAction((CCAction)(rot.Copy()));
            white.RunAction((CCAction)(rot.Copy()));
        }
Example #6
0
        public override void OnEnter()
        {
            base.OnEnter();

            this.TouchEnabled = true;

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80), s.Width * 0.75f, s.Height * 0.75f);

            layer.IgnoreAnchorPointForPosition = false;
            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.Create("LABEL1", "fonts/konqa32.fnt");
            layer.AddChild(label1);
            label1.Position = new CCPoint(layer.ContentSize.Width / 2, layer.ContentSize.Height * 0.75f);
            CCLabelBMFont label2 = CCLabelBMFont.Create("LABEL2", "fonts/konqa32.fnt");
            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 = new CCHide();
            CCScaleTo scaleTo1 = new CCScaleTo(0.0f, 0.0f);
            CCShow show = new CCShow();
            CCDelayTime delay = new CCDelayTime (waitTime);
            CCScaleTo scaleTo2 = new CCScaleTo(runTime * 0.25f, 1.2f);
            CCScaleTo scaleTo3 = new CCScaleTo(runTime * 0.25f, 0.95f);
            CCScaleTo scaleTo4 = new CCScaleTo(runTime * 0.25f, 1.1f);
            CCScaleTo scaleTo5 = new CCScaleTo(runTime * 0.25f, 1.0f);

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

            layer.RunAction(seq);
        }
Example #7
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_tamara.RemoveFromParentAndCleanup(true);
            m_grossini.RemoveFromParentAndCleanup(true);
            m_kathia.RemoveFromParentAndCleanup(true);

            // Get window size so that we can center the box layer
            var winSize = CCDirector.SharedDirector.WinSize;

            var boxSize = new CCSize(100.0f, 100.0f);

            var box = new CCLayerColor(new CCColor4B(255, 255, 0, 255));
            box.AnchorPoint = new CCPoint(0, 0);
            box.Position = new CCPoint(winSize.Center.X - (boxSize.Width / 2), winSize.Center.Y - (boxSize.Height / 2));
            box.ContentSize = boxSize;

            var uL = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
            box.AddChild(uL);
            uL.ContentSize = new CCSize(markrside, markrside);
            uL.Position = new CCPoint(0.0f, boxSize.Height - markrside);
            uL.AnchorPoint = new CCPoint(0, 0);

            var uR = new CCLayerColor(new CCColor4B(0, 0, 255, 255));
            box.AddChild(uR);
            uR.ContentSize = new CCSize(markrside, markrside);
            uR.Position = new CCPoint(boxSize.Width - markrside, boxSize.Height - markrside);
            uR.AnchorPoint = new CCPoint(0, 0);
            AddChild(box);

            var actionTo = new CCSkewTo (2, 0.0f, 2.0f);
            var rotateTo = new CCRotateTo (2, 61.0f);
            var actionScaleTo = new CCScaleTo(2, -0.44f, 0.47f);

            var actionScaleToBack = new CCScaleTo(2, 1.0f, 1.0f);
            var rotateToBack = new CCRotateTo (2, 0);
            var actionToBack = new CCSkewTo (2, 0, 0);

            box.RunAction(CCSequence.FromActions(actionTo, actionToBack));
            box.RunAction(CCSequence.FromActions(rotateTo, rotateToBack));
            box.RunAction(CCSequence.FromActions(actionScaleTo, actionScaleToBack));
        }