Esempio n. 1
0
        public TextLayer() : base()
        {

            Color = new CCColor3B(32, 128, 32);
            Opacity = 255;

            BaseNode = new CCNodeGrid();
            var effect = CurrentAction;
            BaseNode.RunAction(effect);
            AddChild(BaseNode, 0, EffectTestScene.kTagBackground);

            var bg = new CCSprite(TestResource.s_back3);
            BaseNode.AddChild(bg, 0);

            var Kathia = new CCSprite(TestResource.s_pPathSister2);
            BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia);

            var sc = new CCScaleBy(2, 5);
            var sc_back = sc.Reverse();
            Kathia.RunAction(new CCRepeatForever(sc, sc_back));


            var Tamara = new CCSprite(TestResource.s_pPathSister1);
            BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara);

            var sc2 = new CCScaleBy(2, 5);
            var sc2_back = sc2.Reverse();
            Tamara.RunAction(new CCRepeatForever(sc2, sc2_back));

        }
Esempio n. 2
0
		public TextLayer() : base()
		{

            Camera = AppDelegate.SharedCamera;
            contentLayer = new CCLayer();
            CCCamera contentCamera = new CCCamera(Camera.OrthographicViewSizeWorldspace, Camera.CenterInWorldspace, Camera.TargetInWorldspace);
            contentLayer.Camera = contentCamera;

            var bg = new CCSprite(TestResource.s_back3);
            BaseNode = bg;
            contentLayer.AddChild(bg, 0, EffectTestScene.kTagBackground);

            var Kathia = new CCSprite(TestResource.s_pPathSister2);
            BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia);

            var sc = new CCScaleBy(2, 5);
            var sc_back = sc.Reverse();
            Kathia.RunAction(new CCRepeatForever(sc, sc_back));


            var Tamara = new CCSprite(TestResource.s_pPathSister1);
            BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara);

            var sc2 = new CCScaleBy(2, 5);
            var sc2_back = sc2.Reverse();
            Tamara.RunAction(new CCRepeatForever(sc2, sc2_back));

            var colorBackground = new CCLayerColor(new CCColor4B(32, 128, 32, 255));
            contentLayer.AddChild(colorBackground, -1);
		}
Esempio n. 3
0
		public TextLayer() : base()
		{

            contentLayer = new CCLayer();
            CCCamera contentCamera = Camera;
            contentLayer.Camera = contentCamera;

            var bg = new CCSprite(TestResource.s_back3);
            BaseNode = bg;
            contentLayer.AddChild(bg, 0, EffectTestScene.kTagBackground);

            var Kathia = new CCSprite(TestResource.s_pPathSister2);
            BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia);

            var sc = new CCScaleBy(2, 5);
            var sc_back = sc.Reverse();
            Kathia.RunAction(new CCRepeatForever(sc, sc_back));


            var Tamara = new CCSprite(TestResource.s_pPathSister1);
            BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara);

            var sc2 = new CCScaleBy(2, 5);
            var sc2_back = sc2.Reverse();
            Tamara.RunAction(new CCRepeatForever(sc2, sc2_back));

            var colorBackground = new CCLayerColor(new CCColor4B(32, 128, 32, 255));
            contentLayer.AddChild(colorBackground, -1);
		}
Esempio n. 4
0
        void AddNewSpriteWithCoords(CCPoint p)
        {
            CCSpriteBatchNode BatchNode = (CCSpriteBatchNode)GetChildByTag((int)kTags.kTagSpriteBatchNode);

            int idx = (int)(CCRandom.NextDouble() * 1400 / 100);
            int x = (idx % 5) * 85;
            int y = (idx / 5) * 121;


            CCSprite sprite = new CCSprite(BatchNode.Texture, new CCRect(x, y, 85, 121));
            sprite.Position = (new CCPoint(p.X, p.Y));
            BatchNode.AddChild(sprite);


            CCFiniteTimeAction action = null;
            float random = (float)CCRandom.NextDouble();

            if (random < 0.20)
                action = new CCScaleBy(3, 2);
            else if (random < 0.40)
                action = new CCRotateBy (3, 360);
            else if (random < 0.60)
                action = new CCBlink (1, 3);
            else if (random < 0.8)
                action = new CCTintBy (2, 0, -255, -255);
            else
                action = new CCFadeOut  (2);

            CCFiniteTimeAction action_back = (CCFiniteTimeAction)action.Reverse();
            CCFiniteTimeAction seq = (CCFiniteTimeAction)(new CCSequence(action, action_back));

            sprite.RunAction(new CCRepeatForever (seq));
        }
Esempio n. 5
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

			var sp1 = new CCSprite(TestResource.s_pPathSister1);
			var sp2 = new CCSprite(TestResource.s_pPathSister2);
			var sp3 = new CCSprite(TestResource.s_pPathSister1);
			var sp4 = new CCSprite(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);

			var a1 = new CCRotateBy (2, 360);
			var a2 = new CCScaleBy(2, 2);

			var action1 = new CCRepeatForever (a1, a2, a2.Reverse());

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

            sp1.RunAction(action1);
			sp2.RunAction(action1);
        }
Esempio n. 6
0
        public TMXOrthoTest() : base("TileMaps/orthogonal-test2")
        {
            // it should not flicker. No artifacts should appear

            var scale = new CCScaleBy(10, 0.1f);
            var back = scale.Reverse();
            tileLayersContainer.RepeatForever(scale, back);
        }
        public SpriteBatchNodeOffsetAnchorSkew()
        {
            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);

            // skew
            CCSkewBy skewX = new CCSkewBy (2, 45, 0);
            CCFiniteTimeAction skewX_back = (CCFiniteTimeAction)skewX.Reverse();
            CCSkewBy skewY = new CCSkewBy (2, 0, 45);
            CCFiniteTimeAction skewY_back = (CCFiniteTimeAction)skewY.Reverse();

            // scale 
            CCScaleBy scale = new CCScaleBy(2, 2);
            CCFiniteTimeAction scale_back = (CCFiniteTimeAction)scale.Reverse();

            seq_scale = new CCSequence(scale, scale_back);
            seq_skew = new CCSequence(skewX, skewX_back, skewY, skewY_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);
            }
        }
Esempio n. 8
0
        public SpriteAliased()
        {
            sprite1 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121));
            AddChild(sprite1, 0, (int)kTagSprite.kTagSprite1);

            sprite2 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121));
            AddChild(sprite2, 0, (int)kTagSprite.kTagSprite2);

            var scale = new CCScaleBy(2, 5);
            var scale_back = scale.Reverse();
            seq = new CCSequence(scale, scale_back);

        }
		public override void OnEnter()
		{
            CCRect visibleBounds = Layer.VisibleBoundsWorldspace;

            base.OnEnter();

			bgNode = new CCNodeGrid ();
			bgNode.AnchorPoint = CCPoint.AnchorMiddle;
            contentLayer.AddChild (bgNode);
            //bgNode.Position = visibleBounds.Center;

			var bg = new CCSprite("Images/background3");
            //bg.AnchorPoint = CCPoint.AnchorMiddle;
            bg.Position = visibleBounds.Center;

            //bgNode.ContentSize = bg.ContentSize;

			bgNode.AddChild (bg);


            Target1 = new CCNodeGrid();
            Target1.AnchorPoint = CCPoint.AnchorMiddle;

			grossini = new CCSprite("Images/grossinis_sister2");
            Target1.AddChild(grossini);
            bgNode.AddChild (Target1);

            Target1.Position = bg.BoundingBox.Center + new CCPoint(-100.0f, 0.0f);
            //grossini.Position = 

			var sc = new CCScaleBy(2, 5);
			var sc_back = sc.Reverse();
            Target1.RepeatForever(sc, sc_back);

            Target2 = new CCNodeGrid();
            Target2.AnchorPoint = CCPoint.AnchorMiddle;

            tamara = new CCSprite("Images/grossinis_sister1");

            Target2.AddChild(tamara);
            bgNode.AddChild(Target2);

            Target2.Position = bg.BoundingBox.Center + new CCPoint(100.0f, 0.0f);

			var sc2 = new CCScaleBy(2, 5);
			var sc2_back = sc2.Reverse();

			tamara.RepeatForever(sc2, sc2_back);

		}
Esempio n. 10
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);
        }
Esempio n. 11
0
        private void performanceActions(CCSprite pSprite)
        {
            CCSize size = Layer.VisibleBoundsWorldspace.Size;
            pSprite.Position = new CCPoint((CCRandom.Next() % (int) size.Width), (CCRandom.Next() % (int) size.Height));

            float period = 0.5f + (CCRandom.Next() % 1000) / 500.0f;
            CCRotateBy rot = new CCRotateBy (period, 360.0f * CCRandom.Float_0_1());
            var rot_back = rot.Reverse();
            CCAction permanentRotation = new CCRepeatForever (new CCSequence(rot, rot_back));
            pSprite.RunAction(permanentRotation);

            float growDuration = 0.5f + (CCRandom.Next() % 1000) / 500.0f;
            CCFiniteTimeAction grow = new CCScaleBy(growDuration, 0.5f, 0.5f);
            CCAction permanentScaleLoop = new CCRepeatForever (new CCSequence (grow, grow.Reverse()));
            pSprite.RunAction(permanentScaleLoop);
        }
        public SpriteBatchNodeAliased()
        {
            var batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 10);
            AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);

            sprite1 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
            batch.AddChild(sprite1, 0, (int)kTagSprite.kTagSprite1);

            sprite2 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
            batch.AddChild(sprite2, 0, (int)kTagSprite.kTagSprite2);

            var scale = new CCScaleBy(2, 5);
            var scale_back = (CCFiniteTimeAction)scale.Reverse();

            repeat = new CCRepeatForever (scale, scale_back);
        }
        public SpriteOffsetAnchorSkewScale()
        {
            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            // Create actions

            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");
            var animFrames = new List<CCSpriteFrame>();
            string tmp = "";
            for (int j = 0; j < 14; j++)
            {
                tmp = string.Format("grossini_dance_{0:00}.png", j + 1);
                CCSpriteFrame frame = cache[tmp];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);

            // Skew
            CCSkewBy skewX = new CCSkewBy (2, 45, 0);
            CCFiniteTimeAction skewX_back = (CCFiniteTimeAction)skewX.Reverse();
            CCSkewBy skewY = new CCSkewBy (2, 0, 45);
            CCFiniteTimeAction skewY_back = (CCFiniteTimeAction)skewY.Reverse();

            seq_skew = new CCSequence(skewX, skewX_back, skewY, skewY_back);

            // Scale
            CCScaleBy scale = new CCScaleBy(2, 2);
            CCFiniteTimeAction scale_back = (CCFiniteTimeAction)scale.Reverse();

            seq_scale = new CCSequence(scale, scale_back);


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

                pointSprites[i] = new CCSprite("Images/r1");
                AddChild(pointSprites[i], 1);
            }
        }
Esempio n. 14
0
        public SpriteOffsetAnchorScale()
        {
            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");

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

            var animFrames = new List<CCSpriteFrame>(14);
            string str = "";
            for (int j = 0; j < 14; j++)
            {
                string temp = "";
                if (j + 1 < 10)
                {
                    temp = "0" + (j + 1);
                }
                else
                {
                    temp = (j + 1).ToString();
                }
                str = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = cache[str];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);

            for (int i = 0; i < numOfSprites; i++)
            {
                // Animation using Sprite BatchNode
                sprites[i] = new CCSprite("grossini_dance_01.png");
                AddChild(sprites[i], 0);

                pointSprites[i] = new CCSprite("Images/r1");
                AddChild(pointSprites[i], 1);


                CCFiniteTimeAction scale = new CCScaleBy(2, 2);
                CCFiniteTimeAction scale_back = (CCFiniteTimeAction)scale.Reverse();
                seq_scale = (CCFiniteTimeAction)(new CCSequence(scale, scale_back));
            }
        }
Esempio n. 15
0
        public Sprite6()
        {
            // small capacity. Testing resizing
            // Don't use capacity=1 in your real game. It is expensive to resize the capacity
            batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 1);


            // SpriteBatchNode actions
            rotate = new CCRotateBy(5, 360);
            action = new CCRepeatForever(rotate);

            // SpriteBatchNode actions
            rotate_back = rotate.Reverse();

            scale = new CCScaleBy(5, 1.5f);
            scale_back = scale.Reverse();

            for (int i = 0; i < 3; i++)
            {
                CCSprite sprite = new CCSprite(batch.Texture, new CCRect(85 * i, 121 * 1, 85, 121));
                batch.AddChild(sprite, i);
            }
        }
Esempio n. 16
0
        void AddNewSprite()
        {
            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCPoint p = new CCPoint((float)(CCRandom.NextDouble() * s.Width), (float)(CCRandom.NextDouble() * s.Height));

            int idx = (int)(CCRandom.NextDouble() * 1400 / 100);
            int x = (idx % 5) * 85;
            int y = (idx / 5) * 121;


            CCNode node = GetChildByTag((int)kTags.kTagSpriteBatchNode);
            CCSprite sprite = new CCSprite(texture1, new CCRect(x, y, 85, 121));
            node.AddChild(sprite);

            sprite.Position = (new CCPoint(p.X, p.Y));

            CCFiniteTimeAction action;
            float random = (float)CCRandom.NextDouble();

            if (random < 0.20)
                action = new CCScaleBy(3, 2);
            else if (random < 0.40)
                action = new CCRotateBy (3, 360);
            else if (random < 0.60)
                action = new CCBlink (1, 3);
            else if (random < 0.8)
                action = new CCTintBy (2, 0, -255, -255);
            else
                action = new CCFadeOut  (2);

            CCFiniteTimeAction action_back = (CCFiniteTimeAction)action.Reverse();
            CCFiniteTimeAction seq = (CCFiniteTimeAction)(new CCSequence(action, action_back));

            sprite.RunAction(new CCRepeatForever (seq));
        }
Esempio n. 17
0
        public TileMapTest()
        {
            CCTileMapAtlas map = new CCTileMapAtlas(s_TilesPng, s_LevelMapTga, 16, 16);
            // Convert it to "alias" (GL_LINEAR filtering)
			map.IsAntialiased = true;

            CCSize s = map.ContentSize;
            CCLog.Log("ContentSize: {0}, {1}", s.Width, s.Height);

            // If you are not going to use the Map, you can free it now
            // NEW since v0.7
            map.ReleaseMap();

            AddChild(map, 0, kTagTileMap);

			map.AnchorPoint = CCPoint.AnchorMiddleLeft;

            CCScaleBy scale = new CCScaleBy(4, 0.8f);
            CCFiniteTimeAction scaleBack = scale.Reverse();

            var seq = new CCSequence(scale, scaleBack);

            map.RunAction(new CCRepeatForever ((CCFiniteTimeAction)seq));
        }
Esempio n. 18
0
        public override void OnEnter()
        {
            base.OnEnter(); 

            CenterSprites(3);

            var actionTo = new CCScaleTo(2, 0.5f);
            var actionBy = new CCScaleBy(2, 1, 10);
            var actionBy2 = new CCScaleBy(2, 5f, 1.0f);

            Grossini.RunAction(actionTo);
            Tamara.RunAction(new CCSequence(actionBy, actionBy.Reverse()));
            Kathia.RunAction(new CCSequence(actionBy2, actionBy2.Reverse()));
        }
Esempio n. 19
0
        void AddNewSpriteWithCoords(CCPoint p)
        {
            int idx = (int)(CCMacros.CCRandomBetween0And1() * 1400.0f / 100.0f);
            int x = (idx % 5) * 85;
            int y = (idx / 5) * 121;

            CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(x, y, 85, 121));
            AddChild(sprite);

            sprite.Position = p;

            CCFiniteTimeAction action;
            float random = CCMacros.CCRandomBetween0And1();

            if (random < 0.20)
                action = new CCScaleBy(3, 2);
            else if (random < 0.40)
                action = new CCRotateBy (3, 360);
            else if (random < 0.60)
                action = new CCBlink (1, 3);
            else if (random < 0.8)
                action = new CCTintBy (2, 0, -255, -255);
            else
                action = new CCFadeOut  (2);
            object obj = action.Reverse();
            CCFiniteTimeAction action_back = (CCFiniteTimeAction)action.Reverse();
            CCFiniteTimeAction seq = (CCFiniteTimeAction)(new CCSequence(action, action_back));

            sprite.RunAction(new CCRepeatForever (seq));
        }
Esempio n. 20
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;
        }
Esempio n. 21
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;
        }
Esempio n. 22
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            //
            // Sprite 1: GL_LINEAR
            //
            // Default filter is GL_LINEAR

            CCSprite sprite = new CCSprite("Images/grossinis_sister1");
            sprite.Position = new CCPoint(s.Width / 3.0f, s.Height / 2.0f);
            AddChild(sprite);

            // this is the default filterting
            sprite.IsAntialiased = true;

            //
            // Sprite 1: GL_NEAREST
            //	

            CCSprite sprite2 = new CCSprite("Images/grossinis_sister2");
            sprite2.Position = new CCPoint(2 * s.Width / 3.0f, s.Height / 2.0f);
            AddChild(sprite2);

            // Use Nearest in this one
            sprite2.IsAntialiased = false;

            // scale them to show
			var sc = new CCScaleBy(3, 8.0f);
			var sc_back = sc.Reverse();
            CCRepeatForever scaleforever = new CCRepeatForever(sc, sc_back);

            sprite2.RunAction(scaleforever);
			sprite.RunAction(scaleforever);
            CCTextureCache.SharedTextureCache.DumpCachedTextureInfo();
        }
Esempio n. 23
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_nImageOffset = 0;

            CCSize size = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf label = new CCLabelTtf("Loading...", "Marker Felt", 32);
            label.Position = size.Center;
            AddChild(label, 10);

			var scale = new CCScaleBy(0.3f, 2);
			label.RepeatForever(scale, scale.Reverse());

            ScheduleOnce(LoadImages, 1.0f);
        }
Esempio n. 24
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize size = Layer.VisibleBoundsWorldspace.Size;

            // The .png image MUST be power of 2 in order to create a continue effect.
            // eg: 32x64, 512x128, 256x1024, 64x64, etc..
            var sprite = new CCSprite("Images/pattern1.png", new CCRect(0, 0, 4096, 4096));
            AddChild(sprite, -1, (int) enumTag.kTagSprite1);
            sprite.Position = new CCPoint(size.Width / 2, size.Height / 2);

            // Cocos2D-XNA no longer uses TexParameters.  Please use the XNA SamplerState
//            sprite.Texture.TexParameters = new CCTexParams() {  MagFilter = (uint)All.Linear,
//                                                                MinFilter = (uint)All.Linear,
//                                                                WrapS = (uint)All.Repeat,
//                                                                WrapT = (uint)All.Repeat
//                                                              };

            sprite.Texture.SamplerState = SamplerState.LinearWrap;

            var rotate = new CCRotateBy(4, 360);
            sprite.RunAction(rotate);
            var scale = new CCScaleBy(2, 0.04f);
            var scaleBack = (CCScaleBy) scale.Reverse();
            var seq = new CCSequence(scale, scaleBack);
            sprite.RunAction(seq);

        }
Esempio n. 25
0
 protected virtual CCAction ActionScale()
 {
     var scale = new CCScaleBy(1.33f, 1.5f);
     return new CCRepeatForever(new CCSequence(scale, scale.Reverse()));
 }
Esempio n. 26
0
		public void createParticlesAsync()
		{

			isLoading = true;


			var label = new CCLabelTtf("Loading...", "MarkerFelt", 22);
			label.Position = _screenSize.Center;
			label.Position = new CCPoint(_screenSize.Center.X, _screenSize.Height * 0.75f);

			label.Visible = false;
			label.Name = "Loading";
			AddChild(label, 10);

			var scale = new CCScaleBy(0.3f, 2);
			label.RunActions(new CCDelayTime(1.0f), new CCShow());
			label.RepeatForever(scale, scale.Reverse());



			CCParticleSystemCache.SharedParticleSystemCache.AddParticleSystemAsync("jet.plist",

				(jetConfig) =>
				{
					_jet = new CCParticleSystemQuad(jetConfig);
					_jet.SourcePosition = new CCPoint(-_rocket._radius * 0.8f, 0);
					_jet.Angle = 180;
					_jet.StopSystem();
					AddChild(_jet, kBackground);

					loadedParticleSystems++;
					updateLoading();
				});

			CCParticleSystemCache.SharedParticleSystemCache.AddParticleSystemAsync("boom.plist",

				(boomConfig) =>
				{
					_boom = new CCParticleSystemQuad(boomConfig);
					_boom.StopSystem();
					AddChild(_boom, kForeground);
					loadedParticleSystems++;
					updateLoading();
				});

			CCParticleSystemCache.SharedParticleSystemCache.AddParticleSystemAsync("comet.plist",

				(cometConfig) =>
				{
					_comet = new CCParticleSystemQuad(cometConfig);
					_comet.StopSystem();
					_comet.Position = new CCPoint(0, _screenSize.Height * 0.6f);
					_comet.Visible = false;
					AddChild(_comet, kForeground);
					loadedParticleSystems++;
					updateLoading();
				});


			CCParticleSystemCache.SharedParticleSystemCache.AddParticleSystemAsync("star.plist",

			   (starConfig) =>
			   {
				   _star = new CCParticleSystemQuad(starConfig);
				   _star.StopSystem();
				   _star.Visible = false;
				   AddChild(_star, kBackground, kSpriteStar);
				   loadedParticleSystems++;
				   updateLoading();
			   });

			CCParticleSystemCache.SharedParticleSystemCache.AddParticleSystemAsync("plink.plist",

				(plinkConfig) =>
				{
					_pickup = new CCParticleSystemQuad(plinkConfig);
					_pickup.StopSystem();
					AddChild(_pickup, kMiddleground);
					loadedParticleSystems++;
					updateLoading();
				});


			CCParticleSystemCache.SharedParticleSystemCache.AddParticleSystemAsync("warp.plist",

				(warpConfig) =>
				{
					_warp = new CCParticleSystemQuad(warpConfig);
					_warp.Position = _rocket.Position;
					AddChild(_warp, kBackground);
					loadedParticleSystems++;
					updateLoading();
				});


		}