Ejemplo n.º 1
0
        public override void OnEnter()
        {
            base.OnEnter();

            // 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)
			var shaky = new CCShakyTiles3D(5, new CCGridSize(15, 10), 4, false);
			var shuffle = new CCShuffleTiles(new CCGridSize(15, 10), 3, 0);
			var turnoff = new CCTurnOffTiles(3, new CCGridSize(15, 10), 0);
			var turnon = turnoff.Reverse();

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

			var delay = new CCDelayTime (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]]];
			bgNode.RunActions (shaky, delay, reuse, shuffle, delay, turnoff, turnon);
        }
Ejemplo n.º 2
0
        public override void OnEnter()
        {
            base.OnEnter();

            Window.IsUseDepthTesting = true;

            CCRect visibleBounds = VisibleBoundsWorldspace;

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

            var lens = new CCLens3D(3.0f, new CCGridSize(15, 10), bgNode.ContentSize.Center, 200);
			var waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 30);


			var reuse = new CCReuseGrid(1);
			var delay = new CCDelayTime (8);

            bgNode.AnchorPoint = CCPoint.AnchorMiddle;
            var orbit = new CCOrbitCamera(5, 30.0f, 2, 20, 180, 0, -90);
			var orbit_back = orbit.Reverse();

			bgNode.RepeatForever(orbit, orbit_back);
			bgNode.RunActions(lens, delay, reuse, waves);
        }
Ejemplo n.º 3
0
		public static CCFiniteTimeAction ActionWithDuration(float t)
		{
			CCFlipX3D flipx = new CCFlipX3D(t);
			CCFiniteTimeAction flipx_back = flipx.Reverse();
			CCDelayTime delay = new CCDelayTime (2);

			return new CCSequence(flipx, delay, flipx_back);
		}
Ejemplo n.º 4
0
		public static CCFiniteTimeAction ActionWithDuration(float t)
        {
            var fadeout = new CCFadeOutUpTiles(t, new CCGridSize(16, 12));
            var back = fadeout.Reverse();
            var delay = new CCDelayTime (0.5f);

			return new CCSequence(fadeout, delay, back);
        }
Ejemplo n.º 5
0
		public static CCFiniteTimeAction ActionWithDuration(float t)
        {
            var shuffle = new CCShuffleTiles(new CCGridSize(16, 12), t, 25);
            var shuffle_back = shuffle.Reverse();
            var delay = new CCDelayTime (2);

			return new CCSequence(shuffle, delay, shuffle_back);
        }
Ejemplo n.º 6
0
		public static CCFiniteTimeAction ActionWithDuration(float t)
        {
            var flipY = new CCFlipY3D (t);
            var flipY_Reverse = flipY.Reverse();
            var delay = new CCDelayTime (2);

			return new CCSequence(flipY, delay, flipY_Reverse);
        }
Ejemplo n.º 7
0
        public void disableMenuCallback(object pSender)
        {
            m_pMenu1.Enabled = false;
            CCDelayTime wait = new CCDelayTime (5);
            CCCallFunc enable = new CCCallFunc(enableMenuCallback);

            CCFiniteTimeAction seq = new CCSequence(wait, enable);
            m_pMenu1.RunAction(seq);
        }
Ejemplo n.º 8
0
        public void disableMenuCallback(object pSender)
        {
            menu1.Enabled = false;
            var wait = new CCDelayTime (5);
            var enable = new CCCallFunc(enableMenuCallback);

            var seq = new CCSequence(wait, enable);
            menu1.RunAction(seq);
        }
        public SpriteBatchNodeOffsetAnchorFlip()
        {
            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");

            // Create animations and actions

            var animFrames = new List<CCSpriteFrame>();
            string tmp = "";
            for (int j = 0; j < 14; j++)
            {
                string temp = "";
                if (j+1<10)
                {
                    temp = "0" + (j + 1);
                }
                else
                {
                    temp = (j + 1).ToString();
                }

                tmp = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = cache[tmp];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);


            CCFlipY flip = new CCFlipY(true);
            CCFlipY flip_back = new CCFlipY(false);
            CCDelayTime delay = new CCDelayTime (1);

            seq = new CCSequence(delay, flip, delay, flip_back);

            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            for (int i = 0; i < numOfSprites; i++)
            {
                // Animation using Sprite batch
                sprites[i] = new CCSprite("grossini_dance_01.png");
                pointSprites[i] = new CCSprite("Images/r1");

                CCSpriteBatchNode spritebatch = new CCSpriteBatchNode("animations/grossini");
                AddChild(spritebatch);
                AddChild(pointSprites[i], 200);
                spritebatch.AddChild(sprites[i], i);
            }
        }
Ejemplo n.º 10
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

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


            CCCamera contentCamera = contentLayer.Camera;

            contentCamera.Projection = CCCameraProjection.Projection3D;
            contentCamera.PerspectiveAspectRatio = 1.0f;

            CCPoint3 cameraCenter = contentCamera.CenterInWorldspace;
            CCPoint3 cameraTarget = contentCamera.TargetInWorldspace;

            float targeCenterLength = (cameraTarget - cameraCenter).Length;


            contentCamera.NearAndFarPerspectiveClipping = new CCPoint (0.1f, 100.0f);

            contentCamera.PerspectiveFieldOfView = (float)Math.PI / 3.0f; //(float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength));

            var lens = new CCLens3D(0.0f, new CCGridSize(15, 10), bgNode.ContentSize.Center, 90);
			var waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 15);


			var reuse = new CCReuseGrid(1);
			var delay = new CCDelayTime (8);

            bgNode.AnchorPoint = CCPoint.AnchorMiddle;
            var orbit = new CCOrbitCamera(5, 30.0f, 2, 20, 180, 0, -90);
			var orbit_back = orbit.Reverse();

			bgNode.RepeatForever(orbit, orbit_back);
			bgNode.RunActions(lens, delay, reuse, waves);
        }
Ejemplo n.º 11
0
        public override void OnEnter()
        {
            base.OnEnter();

            var move = new CCMoveBy (3, new CCPoint(VisibleBoundsWorldspace.Right().X - 130, 0));
            var move_back = move.Reverse();

            var move_ease_in = new CCEaseSineIn(move);
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out = new CCEaseSineOut(move);
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move, delay, move_back, delay);
            var seq2 = new CCSequence(move_ease_in, delay, move_ease_in_back, delay);
            var seq3 = new CCSequence(move_ease_out, delay, move_ease_out_back,
                                                delay);

            m_grossini.RepeatForever(seq1);
            m_tamara.RepeatForever(seq2);
            m_kathia.RepeatForever(seq3);
        }
Ejemplo n.º 12
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;
            var layer1 = new CCLayer();

            var sister1 = new CCSprite("Images/grossinis_sister1.png");
            var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label = new CCLabel("Test", "fonts/bitmapFontTest.fnt");

            layer1.AddChild(sister1);
            layer1.AddChild(sister2);
            layer1.AddChild(label);
            this.AddChild(layer1, 0, kTagLayer);

            sister1.Position = new CCPoint(s.Width * 1 / 3, s.Height / 2);
            sister2.Position = new CCPoint(s.Width * 2 / 3, s.Height / 2);
            label.Position = new CCPoint(s.Width / 2, s.Height / 2);

			// Define our delay time
			var delay = new CCDelayTime (1);

			layer1.RepeatForever (
                new CCTintTo(6, 255, 0, 255),
                new CCTintTo(6, 255, 255, 255),
				delay
                );

			sister1.RepeatForever (
                new CCTintTo(2, 255, 255, 0),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 0, 255, 255),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 255, 0, 255),
                new CCTintTo(2, 255, 255, 255),
				delay
                );

            // Enable cascading in scene
            SetEnableRecursiveCascading(this, true);
        }
Ejemplo n.º 13
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var move = new CCMoveBy (3, new CCPoint(s.Width - 130, 0));

            var move_ease_inout1 = new CCEaseElasticInOut(move, 0.3f);
            var move_ease_inout_back1 = move_ease_inout1.Reverse();

            var move_ease_inout2 = new CCEaseElasticInOut(move, 0.45f);
            var move_ease_inout_back2 = move_ease_inout2.Reverse();

            var move_ease_inout3 = new CCEaseElasticInOut(move, 0.6f);
            var move_ease_inout_back3 = move_ease_inout3.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move_ease_inout1, delay, move_ease_inout_back1, delay);
            var seq2 = new CCSequence(move_ease_inout2, delay, move_ease_inout_back2,
                                                delay);
            var seq3 = new CCSequence(move_ease_inout3, delay, move_ease_inout_back3,
                                                delay);

            m_tamara.RunAction(new CCRepeatForever (seq1));
            m_kathia.RunAction(new CCRepeatForever (seq2));
            m_grossini.RunAction(new CCRepeatForever (seq3));
        }
Ejemplo n.º 14
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;
            var layer1 = new CCLayer();


			var sister1 = new CCSprite("Images/grossinis_sister1.png");
			var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label = new CCLabelBMFont("Test", "fonts/bitmapFontTest.fnt");
			// by default a CCLabelBMFont has IsColorModifiedByOpacity on by default if the 
			// texture atlas is PreMultipliedAlpha.  Label as used by Cocos2d-x by default has
			// this set to false.  Maybe this is a bug in Cocos2d-x?
			label.IsColorModifiedByOpacity = false;
    
            layer1.AddChild(sister1);
            layer1.AddChild(sister2);
            layer1.AddChild(label);
            this.AddChild( layer1, 0, kTagLayer);
    
            sister1.Position= new CCPoint( s.Width*1/3, s.Height/2);
            sister2.Position = new CCPoint( s.Width*2/3, s.Height/2);
            label.Position = new CCPoint(s.Width / 2, s.Height / 2);

			// Define our delay time
			var delay = new CCDelayTime (1);

			layer1.RepeatForever(
                        new CCFadeTo(4, 0),
                        new CCFadeTo(4, 255),
						delay
                );

			// We only have to define them once.
			var fadeTo11 = new CCFadeTo (2, 0);
			var fadeTo12 = new CCFadeTo (2, 255);

			sister1.RepeatForever(
						fadeTo11,
						fadeTo12,
						fadeTo11,
						fadeTo12,
						delay
                );
    
    
            // Enable cascading in scene
            SetEnableRecursiveCascading(this, true);
        }
Ejemplo n.º 15
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var layer1 = new CCLayerColor(new CCColor4B(192, 0, 0, 255));
            layer1.IsColorCascaded = false;

            layer1.Position = new CCPoint(0, s.Height / 2);

            var sister1 = new CCSprite("Images/grossinis_sister1.png");
            var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label = new CCLabelBMFont("Test", "fonts/bitmapFontTest.fnt");

            layer1.AddChild(sister1);
            layer1.AddChild(sister2);
            layer1.AddChild(label);
            this.AddChild(layer1, 0, kTagLayer);

            sister1.Position = new CCPoint(s.Width * 1 / 3, 0);
            sister2.Position = new CCPoint(s.Width * 2 / 3, 0);
            label.Position = new CCPoint(s.Width / 2, 0);

			// Define our delay time
			var delay = new CCDelayTime (1);

			layer1.RepeatForever (
                new CCTintTo(6, 255, 0, 255),
                new CCTintTo(6, 255, 255, 255),
				delay
                );

			sister1.RepeatForever (
                new CCTintTo(2, 255, 255, 0),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 0, 255, 255),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 255, 0, 255),
                new CCTintTo(2, 255, 255, 255),
				delay
                );
        }
Ejemplo n.º 16
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var move = new CCMoveBy (3, new CCPoint(s.Width - 130, 0));
            var move_back = move.Reverse();

            var move_ease_in = new CCEaseBackIn(move);
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out = new CCEaseBackOut(move);
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move, delay, move_back, delay);
            var seq2 = new CCSequence(move_ease_in, delay, move_ease_in_back, delay);
            var seq3 = new CCSequence(move_ease_out, delay, move_ease_out_back,
                                                delay);

            m_grossini.RunAction(new CCRepeatForever (seq1));
            m_tamara.RunAction(new CCRepeatForever (seq2));
            m_kathia.RunAction(new CCRepeatForever (seq3));
        }
Ejemplo n.º 17
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var move = new CCMoveBy (3, new CCPoint(s.Width - 130, 0));
            var move_back = move.Reverse();

            var move_ease = new CCEaseBackInOut(move);
            var move_ease_back = move_ease.Reverse() as CCFiniteTimeAction;

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move, delay, move_back, delay);
            var seq2 = new CCSequence(move_ease, delay, move_ease_back, delay);

            PositionForTwo();

            m_grossini.RunAction(new CCRepeatForever (seq1));
            m_tamara.RunAction(new CCRepeatForever (seq2));
        }
Ejemplo n.º 18
0
        public override void OnEnter()
        {
            base.OnEnter();

            var size = Layer.VisibleBoundsWorldspace.Size;

            var move = new CCMoveBy(3, new CCPoint(size.Width - 130, 0));
            var move_back = (CCFiniteTimeAction) move.Reverse();

            var move_ease_in = new CCEaseIn(move, 2.5f);
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out = new CCEaseOut(move, 2.5f);
            var move_ease_out_back = move_ease_out.Reverse();

			var delay = new CCDelayTime(0.25f);

			var seq1 = new CCSequence(move, delay, move_back, delay) { Tag = 1 };
			var seq2 = new CCSequence(move_ease_in, delay, move_ease_in_back, delay) { Tag = 1 };
            var seq3 = new CCSequence(move_ease_out, delay, move_ease_out_back, delay) { Tag = 1 };

            m_grossini.RepeatForever (seq1);

            m_tamara.RepeatForever (seq2);

            m_kathia.RepeatForever (seq3);

            Schedule(testStopAction, 6.25f);
        }