Пример #1
0
        public NodeToWorld()
        {
            //
            // This code tests that nodeToParent works OK:
            //  - It tests different anchor Points
            //  - It tests different children anchor points

            CCSprite back = new CCSprite(TestResource.s_back3);
            AddChild(back, -10);
            back.AnchorPoint = (new CCPoint(0, 0));
            CCSize backSize = back.ContentSize;

            CCMenuItem item = new CCMenuItemImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect);
            CCMenu menu = new CCMenu(item);
            menu.AlignItemsVertically();
            menu.Position = (new CCPoint(backSize.Width / 2, backSize.Height / 2));
            back.AddChild(menu);

            CCActionInterval rot = new CCRotateBy (5, 360);
            CCAction fe = new CCRepeatForever (rot);
            item.RunAction(fe);

            CCActionInterval move = new CCMoveBy (3, new CCPoint(200, 0));
            var move_back = (CCActionInterval) move.Reverse();
            CCFiniteTimeAction seq = CCSequence.FromActions(move, move_back);
            CCAction fe2 = new CCRepeatForever ((CCActionInterval) seq);
            back.RunAction(fe2);
        }
Пример #2
0
        public override void OnEnter()
        {
            //
            // This test MUST be done in 'onEnter' and not on 'init'
            // otherwise the paused action will be resumed at 'onEnter' time
            //
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLabelTTF l = new CCLabelTTF("After 5 seconds grossini should move", "arial", 16);
            AddChild(l);
            l.Position = (new CCPoint(s.Width / 2, 245));

            //
            // Also, this test MUST be done, after [super onEnter]
            //
            CCSprite grossini = new CCSprite(s_pPathGrossini);
            AddChild(grossini, 0, kTagGrossini);
            grossini.Position = (new CCPoint(200, 200));

            CCAction action = new CCMoveBy (1, new CCPoint(150, 0));

            CCDirector.SharedDirector.ActionManager.AddAction(action, grossini, true);

            Schedule(unpause, 3);
        }
Пример #3
0
        public static new CCMoveBy actionWithDuration(float duration, CCPoint position)
        {
            CCMoveBy ret = new CCMoveBy();
            ret.initWithDuration(duration, position);

            return ret;
        }
        public SpriteBatchNodeChildren()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            // parents
            CCSpriteBatchNode batch = CCSpriteBatchNode.Create("animations/grossini", 50);

            AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("animations/grossini.plist");

            CCSprite sprite1 = new CCSprite("grossini_dance_01.png");
            sprite1.Position = (new CCPoint(s.Width / 3, s.Height / 2));

            CCSprite sprite2 = new CCSprite("grossini_dance_02.png");
            sprite2.Position = (new CCPoint(50, 50));

            CCSprite sprite3 = new CCSprite("grossini_dance_03.png");
            sprite3.Position = (new CCPoint(-50, -50));

            batch.AddChild(sprite1);
            sprite1.AddChild(sprite2);
            sprite1.AddChild(sprite3);

            // BEGIN NEW CODE
            var animFrames = new List<CCSpriteFrame>();
            string str = "";
            for (int i = 1; i < 15; i++)
            {
                string temp = "";
                if (i<10)
                {
                    temp = "0" + i;
                }
                else
                {
                    temp = i.ToString();
                }
                str = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName(str);
                animFrames.Add(frame);
            }

            CCAnimation animation = CCAnimation.Create(animFrames, 0.2f);
            sprite1.RunAction(new CCRepeatForever (new CCAnimate (animation)));
            // END NEW CODE

            CCActionInterval action = new CCMoveBy (2, new CCPoint(200, 0));
            CCActionInterval action_back = (CCActionInterval)action.Reverse();
            CCActionInterval action_rot = new CCRotateBy (2, 360);
            CCActionInterval action_s = new CCScaleBy(2, 2);
            CCActionInterval action_s_back = (CCActionInterval)action_s.Reverse();

            CCActionInterval seq2 = (CCActionInterval)action_rot.Reverse();
            sprite2.RunAction(new CCRepeatForever (seq2));

            sprite1.RunAction((CCAction)(new CCRepeatForever (action_rot)));
            sprite1.RunAction((CCAction)(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(action, action_back)))));
            sprite1.RunAction((CCAction)(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(action_s, action_s_back)))));
        }
Пример #5
0
        public override CCObject copyWithZone(CCZone zone)
        {
            CCZone tmpZone = zone;
            CCMoveBy ret = null;
            if (tmpZone != null && tmpZone.m_pCopyObject != null)
            {
                ret = tmpZone.m_pCopyObject as CCMoveBy;

                if (ret == null)
                {
                    return null;
                }
            }
            else
            {
                ret = new CCMoveBy();
                tmpZone = new CCZone(ret);
            }

            base.copyWithZone(tmpZone);

            ret.initWithDuration(Duration, m_delta);

            return ret;
        }
Пример #6
0
        public StressTest2()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayer sublayer = new CCLayer();

            CCSprite sp1 = new CCSprite(TestResource.s_pPathSister1);
            sp1.Position = (new CCPoint(80, s.Height / 2));

            CCActionInterval move = new CCMoveBy (3, new CCPoint(350, 0));
            CCActionInterval move_ease_inout3 = new CCEaseInOut((CCActionInterval) (move.Copy()), 2.0f);
            var move_ease_inout_back3 = (CCActionInterval) move_ease_inout3.Reverse();
            CCFiniteTimeAction seq3 = CCSequence.FromActions(move_ease_inout3, move_ease_inout_back3);
            sp1.RunAction(new CCRepeatForever ((CCActionInterval) seq3));
            sublayer.AddChild(sp1, 1);

            CCParticleFire fire = CCParticleFire.Create();
            fire.Texture = (CCTextureCache.SharedTextureCache.AddImage("Images/fire"));
            fire.Position = (new CCPoint(80, s.Height / 2 - 50));

            var copy_seq3 = (CCActionInterval) (seq3.Copy());

            fire.RunAction(new CCRepeatForever (copy_seq3));
            sublayer.AddChild(fire, 2);

            Schedule((shouldNotLeak), 6.0f);

            AddChild(sublayer, 0, CocosNodeTestStaticLibrary.kTagSprite1);
        }
Пример #7
0
        public override CCObject copyWithZone(CCZone zone)
        {
            CCZone   tmpZone = zone;
            CCMoveBy ret     = null;

            if (tmpZone != null && tmpZone.m_pCopyObject != null)
            {
                ret = tmpZone.m_pCopyObject as CCMoveBy;

                if (ret == null)
                {
                    return(null);
                }
            }
            else
            {
                ret     = new CCMoveBy();
                tmpZone = new CCZone(ret);
            }

            base.copyWithZone(tmpZone);

            ret.initWithDuration(Duration, m_delta);

            return(ret);
        }
Пример #8
0
        public static new CCMoveBy actionWithDuration(float duration, CCPoint position)
        {
            CCMoveBy cCMoveBy = new CCMoveBy();

            cCMoveBy.initWithDuration(duration, position);
            return(cCMoveBy);
        }
Пример #9
0
        public static new CCMoveBy actionWithDuration(float duration, CCPoint position)
        {
            CCMoveBy ret = new CCMoveBy();

            ret.initWithDuration(duration, position);

            return(ret);
        }
Пример #10
0
        public Parallax1()
        {
            // Top Layer, a simple image
            CCSprite cocosImage = new CCSprite(s_Power);
            // scale the image (optional)
            cocosImage.Scale = 2.5f;
            // change the transform anchor point to 0,0 (optional)
            cocosImage.AnchorPoint = new CCPoint(0, 0);

            // Middle layer: a Tile map atlas
            CCTileMapAtlas tilemap = CCTileMapAtlas.Create(s_TilesPng, s_LevelMapTga, 16, 16);
            tilemap.ReleaseMap();

            // change the transform anchor to 0,0 (optional)
            tilemap.AnchorPoint = new CCPoint(0, 0);

            // Anti Aliased images
            tilemap.Texture.SetAntiAliasTexParameters();

            // background layer: another image
            CCSprite background = new CCSprite(TestResource.s_back);
            // scale the image (optional)
            background.Scale = 1.5f;
            // change the transform anchor point (optional)
            background.AnchorPoint = new CCPoint(0, 0);

            // create a void node, a parent node
            CCParallaxNode voidNode = new CCParallaxNode();

            // NOW add the 3 layers to the 'void' node

            // background image is moved at a ratio of 0.4x, 0.5y
            voidNode.AddChild(background, -1, new CCPoint(0.4f, 0.5f), new CCPoint(0, 0));

            // tiles are moved at a ratio of 2.2x, 1.0y
            voidNode.AddChild(tilemap, 1, new CCPoint(2.2f, 1.0f), new CCPoint(0, -200));

            // top image is moved at a ratio of 3.0x, 2.5y
            voidNode.AddChild(cocosImage, 2, new CCPoint(3.0f, 2.5f), new CCPoint(200, 800));

            // now create some actions that will move the 'void' node
            // and the children of the 'void' node will move at different
            // speed, thus, simulation the 3D environment
            CCMoveBy goUp = new CCMoveBy (4, new CCPoint(0, -500));
            CCFiniteTimeAction goDown = goUp.Reverse();
            CCMoveBy go = new CCMoveBy (8, new CCPoint(-1000, 0));
            CCFiniteTimeAction goBack = go.Reverse();
            CCFiniteTimeAction seq = CCSequence.FromActions(goUp, go, goDown, goBack);

            voidNode.RunAction(new CCRepeatForever ((CCActionInterval) seq));

            AddChild(voidNode, -1, kTagTileMap);
        }
Пример #11
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCNode bg = GetChildByTag(EffectAdvanceScene.kTagBackground);
            CCNode target1 = bg.GetChildByTag(EffectAdvanceScene.kTagSprite1);
            CCNode target2 = bg.GetChildByTag(EffectAdvanceScene.kTagSprite2);

            CCActionInterval waves = CCWaves.Create(5, 20, true, false, new CCGridSize(15, 10), 5);
            CCActionInterval shaky = CCShaky3D.Create(4, false, new CCGridSize(15, 10), 5);

            target1.RunAction(new CCRepeatForever (waves));
            target2.RunAction(new CCRepeatForever (shaky));

            // moving background. Testing issue #244
            CCActionInterval move = new CCMoveBy (3, new CCPoint(200, 0));
            bg.RunAction(new CCRepeatForever (CCSequence.FromActions(move, move.Reverse())));
        }
Пример #12
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            // the root object just rotates around
            m_root = new CCSprite(s_pPathR1);
            AddChild(m_root, 1);
            m_root.Position = new CCPoint(s.Width / 2, s.Height / 2);

            // the target object is offset from root, and the streak is moved to follow it
            m_target = new CCSprite(s_pPathR1);
            m_root.AddChild(m_target);
            m_target.Position = new CCPoint(s.Width / 4, 0);

            // create the streak object and add it to the scene
            streak = CCMotionStreak.Create(2, 3, 32, CCTypes.CCGreen, s_streak);
            streak.FastMode = true;
            AddChild(streak);
            // schedule an update on each frame so we can syncronize the streak with the target
            Schedule(onUpdate);

            var a1 = new CCRotateBy (2, 360);

            var action1 = new CCRepeatForever (a1);
            var motion = new CCMoveBy (2, new CCPoint(100, 0));
            m_root.RunAction(new CCRepeatForever ((CCActionInterval)CCSequence.FromActions(motion, motion.Reverse())));
            m_root.RunAction(action1);

            var colorAction = new CCRepeatForever ((CCActionInterval)
                CCSequence.FromActions(
                    new CCTintTo (0.2f, 255, 0, 0),
                    new CCTintTo (0.2f, 0, 255, 0),
                    new CCTintTo (0.2f, 0, 0, 255),
                    new CCTintTo (0.2f, 0, 255, 255),
                    new CCTintTo (0.2f, 255, 255, 0),
                    new CCTintTo (0.2f, 255, 0, 255),
                    new CCTintTo (0.2f, 255, 255, 255)
                    )
                );

            streak.RunAction(colorAction);
        }
Пример #13
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLabelTTF l = new CCLabelTTF("Should not crash", "arial", 16);
            AddChild(l);
            l.Position = (new CCPoint(s.Width / 2, 245));

            CCMoveBy pMove = new CCMoveBy (2, new CCPoint(200, 0));
            CCCallFunc pCallback = new CCCallFunc(stopAction);
            CCActionInterval pSequence = (CCActionInterval)CCSequence.FromActions(pMove, pCallback);
            pSequence.Tag = (int)KTag.kTagSequence;

            CCSprite pChild = new CCSprite(s_pPathGrossini);
            pChild.Position = (new CCPoint(200, 200));

            AddChild(pChild, 1, kTagGrossini);
            pChild.RunAction(pSequence);
        }
Пример #14
0
        public override CCObject copyWithZone(CCZone zone)
        {
            CCZone   cCZone   = zone;
            CCMoveBy cCMoveBy = null;

            if (cCZone == null || cCZone.m_pCopyObject == null)
            {
                cCMoveBy = new CCMoveBy();
                cCZone   = new CCZone(cCMoveBy);
            }
            else
            {
                cCMoveBy = cCZone.m_pCopyObject as CCMoveBy;
                if (cCMoveBy == null)
                {
                    return(null);
                }
            }
            base.copyWithZone(cCZone);
            cCMoveBy.initWithDuration(this.m_fDuration, this.m_delta);
            return(cCMoveBy);
        }
Пример #15
0
        public TMXOrthoVertexZ()
        {
            CCTMXTiledMap map = CCTMXTiledMap.Create("TileMaps/orthogonal-test-vertexz");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
            // can use any CCSprite and it will work OK.
            CCTMXLayer layer = map.LayerNamed("trees");
            m_tamara = layer.TileAt(new CCPoint(0, 11));
            CCLog.Log("tamara vertexZ: {0}", m_tamara.VertexZ);

            CCMoveBy move = new CCMoveBy (10, new CCPoint(400, 450) * (1f / CCMacros.CCContentScaleFactor()));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = CCSequence.FromActions(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Пример #16
0
        public override void OnEnter()
        {
            // todo : CCOrbitCamera hasn't been implement

            base.OnEnter();

            centerSprites(3);

            var orbit1 = new CCOrbitCamera(2, 1, 0, 0, 180, 0, 0);
            var action1 = CCSequence.FromActions(orbit1,orbit1.Reverse());

            var orbit2 = new CCOrbitCamera(2, 1, 0, 0, 180, -45, 0);
            var action2 = CCSequence.FromActions(orbit2, orbit2.Reverse());

            var orbit3 = new CCOrbitCamera(2, 1, 0, 0, 180, 90, 0);
            var action3 = CCSequence.FromActions(orbit3, orbit3.Reverse());

            m_kathia.RunAction(new CCRepeatForever (action1));
            m_tamara.RunAction(new CCRepeatForever (action2));
            m_grossini.RunAction(new CCRepeatForever (action3));

            var move = new CCMoveBy (3, new CCPoint(100, -100));
            var move_back = move.Reverse();
            var seq = CCSequence.FromActions(move, move_back);
            var rfe = new CCRepeatForever (seq);
            m_kathia.RunAction(rfe);
            m_tamara.RunAction((CCAction) (rfe.Copy()));
            m_grossini.RunAction((CCAction) (rfe.Copy()));
        }
Пример #17
0
        public TMXIsoZorder()
        {
            CCTMXTiledMap map = CCTMXTiledMap.Create("TileMaps/iso-test-zorder");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
            CCLog.Log("ContentSize: {0}, {1}", s.Width, s.Height);
            map.Position = new CCPoint(-s.Width / 2, 0);

            m_tamara = new CCSprite(s_pPathSister1);
            map.AddChild(m_tamara, map.Children.Count);
            float mapWidth = map.MapSize.Width * map.TileSize.Width;
            m_tamara.Position = CCMacros.CCPointPixelsToPoints(new CCPoint(mapWidth / 2, 0));
            m_tamara.AnchorPoint = (new CCPoint(0.5f, 0));

            CCMoveBy move = new CCMoveBy (10, new CCPoint(300, 250));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = CCSequence.FromActions(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Пример #18
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = CCDirector.SharedDirector.WinSize;

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

            var move_ease = new CCEaseSineInOut((CCActionInterval) (move.Copy()));
            var move_ease_back = move_ease.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = CCSequence.FromActions(move, delay, move_back, (CCFiniteTimeAction) delay.Copy());
            var seq2 = CCSequence.FromActions(move_ease, (CCFiniteTimeAction) delay.Copy(), move_ease_back, (CCFiniteTimeAction) delay.Copy());

            positionForTwo();

            m_grossini.RunAction(new CCRepeatForever (seq1));
            m_tamara.RunAction(new CCRepeatForever (seq2));
        }
Пример #19
0
        /// <summary>
        /// returns the action that will be performed by the incomming and outgoing scene
        /// </summary>
        /// <returns></returns>
        public virtual CCActionInterval action()
        {
            CCSize s = Director.SharedDirector.DesignSize;

            return(CCMoveBy.actionWithDuration(m_fDuration, new CCPoint(s.Width - 0.5f, 0)));
        }
Пример #20
0
        /// <summary>
        ///  returns the action that will be performed by the incomming and outgoing scene
        /// </summary>
        /// <returns></returns>
        public override CCActionInterval action()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            return(CCMoveBy.actionWithDuration(m_fDuration, new CCPoint(0, s.height - 0.5f)));
        }
Пример #21
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = CCDirector.SharedDirector.WinSize;

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

            var move_ease_in = new CCEaseExponentialIn((CCActionInterval) (move.Copy()));
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out = new CCEaseExponentialOut((CCActionInterval) (move.Copy()));
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = CCSequence.FromActions(move, delay, move_back, (CCFiniteTimeAction) delay.Copy());
            var seq2 = CCSequence.FromActions(move_ease_in, (CCFiniteTimeAction) delay.Copy(), move_ease_in_back, (CCFiniteTimeAction) delay.Copy());
            var seq3 = CCSequence.FromActions(move_ease_out, (CCFiniteTimeAction) delay.Copy(), move_ease_out_back,
                                                (CCFiniteTimeAction) delay.Copy());

            m_grossini.RunAction(new CCRepeatForever (seq1));
            m_tamara.RunAction(new CCRepeatForever (seq2));
            m_kathia.RunAction(new CCRepeatForever (seq3));
        }
Пример #22
0
 public override CCFiniteTimeAction reverse()
 {
     return(CCMoveBy.actionWithDuration(this.m_fDuration, CCPointExtension.ccp(-this.m_delta.x, -this.m_delta.y)));
 }
Пример #23
0
        public ParticleDemo()
        {
            InitWithColor(CCTypes.CreateColor(127, 127, 127, 255));

            m_emitter = null;

            TouchEnabled = true;

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLabelTTF label = new CCLabelTTF(title(), "arial", 28);
            AddChild(label, 100, 1000);
            label.Position = new CCPoint(s.Width / 2, s.Height - 50);

            CCLabelTTF tapScreen = new CCLabelTTF(subtitle(), "arial", 20);
            tapScreen.Position = new CCPoint(s.Width / 2, s.Height - 80);
            AddChild(tapScreen, 100);

            CCMenuItemImage item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback);

            CCMenuItemToggle item4 = CCMenuItemToggle.Create(toggleCallback,
                                                                     CCMenuItemFont.Create("Free Movement"),
                                                                     CCMenuItemFont.Create("Relative Movement"),
                                                                     CCMenuItemFont.Create("Grouped Movement"));

            CCMenu menu = new CCMenu(item1, item2, item3, item4);

            menu.Position = new CCPoint(0, 0);
            item1.Position = new CCPoint(s.Width / 2 - 100, 30);
            item2.Position = new CCPoint(s.Width / 2, 30);
            item3.Position = new CCPoint(s.Width / 2 + 100, 30);
            item4.Position = new CCPoint(0, 100);
            item4.AnchorPoint = new CCPoint(0, 0);

            AddChild(menu, 100);

            CCLabelAtlas labelAtlas;
            try
            {
                labelAtlas = CCLabelAtlas.Create("0000", "Images/fps_Images", 16, 24, '.');
            }
            catch (Exception)
            {
                labelAtlas = CCLabelAtlas.Create("0000", "Images/fps_Images", 16, 24, '.');
            }
            AddChild(labelAtlas, 100, ParticleTestScene.kTagLabelAtlas);
            labelAtlas.Position = new CCPoint(s.Width - 66, 50);

            // moving background
            m_background = new CCSprite(TestResource.s_back3);
            AddChild(m_background, 5);
            m_background.Position = new CCPoint(s.Width / 2, s.Height - 180);

            CCActionInterval move = new CCMoveBy (4, new CCPoint(300, 0));
            CCFiniteTimeAction move_back = move.Reverse();
            CCFiniteTimeAction seq = CCSequence.FromActions(move, move_back);
            m_background.RunAction(new CCRepeatForever ((CCActionInterval) seq));

            Schedule(step);
        }
Пример #24
0
        public virtual CCActionInterval action()
        {
            CCSize winSize = CCDirector.sharedDirector().getWinSize();

            return(CCMoveBy.actionWithDuration(this.m_fDuration, new CCPoint(winSize.width - 0.5f, 0f)));
        }
Пример #25
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(1);
            var s = CCDirector.SharedDirector.WinSize;

            m_grossini.Position = new CCPoint(-200, s.Height / 2);
            var move = new CCMoveBy (2, new CCPoint(s.Width * 3, 0));
            var move_back = move.Reverse();
            var seq = CCSequence.FromActions(move, move_back);
            var rep = new CCRepeatForever (seq);

            m_grossini.RunAction(rep);

            RunAction(new CCFollow (m_grossini, new CCRect(0, 0, s.Width * 2 - 100, s.Height)));
        }
Пример #26
0
        public override void OnEnter()
        {
            base.OnEnter();

            alignSpritesLeft(2);

            // Test:
            //   Sequence should work both with IntervalAction and InstantActions
            var move1 = new CCMoveBy (1, new CCPoint(250, 0));
            var move2 = new CCMoveBy (1, new CCPoint(0, 50));
            var tog1 = new CCToggleVisibility();
            var tog2 = new CCToggleVisibility();
            var seq = CCSequence.FromActions(move1, tog1, move2, tog2, move1.Reverse());
            var action = new CCRepeat ((CCSequence.FromActions(seq, seq.Reverse())), 3);

            // Test:
            //   Also test that the reverse of Hide is Show, and vice-versa
            m_kathia.RunAction(action);

            var move_tamara = new CCMoveBy (1, new CCPoint(100, 0));
            var move_tamara2 = new CCMoveBy (1, new CCPoint(50, 0));
            var hide = new CCHide();
            var seq_tamara = CCSequence.FromActions(move_tamara, hide, move_tamara2);
            var seq_back = seq_tamara.Reverse();
            m_tamara.RunAction(CCSequence.FromActions(seq_tamara, seq_back));
        }
Пример #27
0
        public override void OnEnter()
        {
            base.OnEnter();

            alignSpritesLeft(1);

            var move1 = new CCMoveBy (1, new CCPoint(250, 0));
            var move2 = new CCMoveBy (1, new CCPoint(0, 50));
            var seq = CCSequence.FromActions(move1, move2, move1.Reverse());
            var action = CCSequence.FromActions(seq, seq.Reverse());

            m_grossini.RunAction(action);
        }
Пример #28
0
        public override void OnEnter()
        {
            base.OnEnter();

            alignSpritesLeft(2);

            var a1 = new CCMoveBy (1, new CCPoint(150, 0));
            var action1 = new CCRepeat (
                CCSequence.FromActions(new CCPlace(new CCPoint(60, 60)), a1),
                3);
            var action2 = new CCRepeatForever (
                (CCSequence.FromActions((CCActionInterval) (a1.Copy()), a1.Reverse()))
                );

            m_kathia.RunAction(action1);
            m_tamara.RunAction(action2);
        }
Пример #29
0
        public TMXOrthoZorder()
        {
            CCTMXTiledMap map = CCTMXTiledMap.Create("TileMaps/orthogonal-test-zorder");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            m_tamara = new CCSprite(s_pPathSister1);
            map.AddChild(m_tamara, map.Children.Count);
            m_tamara.AnchorPoint = (new CCPoint(0.5f, 0));

            CCMoveBy move = new CCMoveBy (10, new CCPoint(400, 450));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = CCSequence.FromActions(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Пример #30
0
        public override void OnEnter()
        {
            base.OnEnter();

            alignSpritesLeft(1);

            var move = new CCMoveBy (1, new CCPoint(150, 0));
            var action = CCSequence.FromActions(move, new CCDelayTime (2), move);

            m_grossini.RunAction(action);
        }
Пример #31
0
        public TMXReadWriteTest()
        {
            m_gid = 0;

            CCTMXTiledMap map = CCTMXTiledMap.Create("TileMaps/orthogonal-test2");
            AddChild(map, 0, kTagTileMap);

            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)); //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 seq0 = CCSequence.FromActions(move, rotate, scale, opacity, fadein, scaleback, finish);
            var seq1 = (CCActionInterval) (seq0.Copy());
            var seq2 = (CCActionInterval) (seq0.Copy());
            var 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;
        }
Пример #32
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(0);

            var spr = new CCSprite("Images/grossini");
            spr.Position = new CCPoint(200, 200);
            AddChild(spr);

            var act1 = new CCMoveBy (2, new CCPoint(0, 100));

            var act2 = new CCCallFunc(log1);
            var act3 = new CCMoveBy (2, new CCPoint(0, -100));
            var act4 = new CCCallFunc(log2);
            var act5 = new CCMoveBy (2, new CCPoint(100, -100));
            var act6 = new CCCallFunc(log3);
            var act7 = new CCMoveBy (2, new CCPoint(-100, 0));
            var act8 = new CCCallFunc(log4);

            var actF = CCSequence.FromActions(act1, act2, act3, act4, act5, act6, act7, act8);

            CCDirector.SharedDirector.ActionManager.AddAction(actF, spr, false);
        }
Пример #33
0
        public override void OnEnter()
        {
            base.OnEnter();

            var size = CCDirector.SharedDirector.WinSize;

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

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

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

            var delay = new CCDelayTime (0.25f);

            var seq1 = CCSequence.FromActions(move, delay, move_back, (CCFiniteTimeAction) delay.Copy());
            var seq2 = CCSequence.FromActions(move_ease_in, (CCFiniteTimeAction) delay.Copy(), move_ease_in_back, (CCFiniteTimeAction) delay.Copy());
            var seq3 = CCSequence.FromActions(move_ease_out, (CCFiniteTimeAction) delay.Copy(), move_ease_out_back,
                                                (CCFiniteTimeAction) delay.Copy());

            var a2 = m_grossini.RunAction(new CCRepeatForever ((CCActionInterval)seq1));
            a2.Tag = 1;

            var a1 = m_tamara.RunAction(new CCRepeatForever ((CCActionInterval)seq2));
            a1.Tag = 1;

            var a = m_kathia.RunAction(new CCRepeatForever ((CCActionInterval)seq3));
            a.Tag = 1;

            Schedule(testStopAction, 6.25f);
        }
Пример #34
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(0);

            var spr = new CCSprite("Images/grossini");
            spr.Position = new CCPoint(100, 100);
            AddChild(spr);

            var act1 = new CCMoveBy (0.5f, new CCPoint(100, 0));
            spr.RunAction(new CCRepeat (act1, 1));
        }
Пример #35
0
        public override void OnEnter()
        {
            base.OnEnter();

            var size = CCDirector.SharedDirector.WinSize;

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

            var move_ease_inout1 = new CCEaseInOut((CCActionInterval) move.Copy(), 0.65f);
            var move_ease_inout_back1 = move_ease_inout1.Reverse();

            var move_ease_inout2 = new CCEaseInOut((CCActionInterval) move.Copy(), 1.35f);
            var move_ease_inout_back2 = move_ease_inout2.Reverse();

            var move_ease_inout3 = new CCEaseInOut((CCActionInterval) move.Copy(), 1.0f);
            var move_ease_inout_back3 = move_ease_inout3.Reverse() as CCActionInterval;

            var delay = new CCDelayTime (0.25f);

            var seq1 = CCSequence.FromActions(move_ease_inout1, delay, move_ease_inout_back1, (CCFiniteTimeAction) delay.Copy());
            var seq2 = CCSequence.FromActions(move_ease_inout2, (CCFiniteTimeAction) delay.Copy(), move_ease_inout_back2,
                                                (CCFiniteTimeAction) delay.Copy());
            var seq3 = CCSequence.FromActions(move_ease_inout3, (CCFiniteTimeAction) delay.Copy(), move_ease_inout_back3,
                                                (CCFiniteTimeAction) delay.Copy());

            m_tamara.RunAction(new CCRepeatForever ((CCActionInterval)seq1));
            m_kathia.RunAction(new CCRepeatForever ((CCActionInterval)seq2));
            m_grossini.RunAction(new CCRepeatForever ((CCActionInterval)seq3));
        }
Пример #36
0
        /// <summary>
        ///  returns the action that will be performed by the incomming and outgoing scene
        /// </summary>
        /// <returns></returns>
        public override CCActionInterval action()
        {
            CCSize s = Director.SharedDirector.DesignSize;

            return(CCMoveBy.actionWithDuration(m_fDuration, new CCPoint(0, s.Height - 0.5f)));
        }
Пример #37
0
 public override CCFiniteTimeAction Reverse()
 {
     return(CCMoveBy.actionWithDuration(Duration, CCPointExtension.ccp(-m_delta.X, -m_delta.Y)));
 }
Пример #38
0
        public TMXIsoVertexZ()
        {
            CCTMXTiledMap map = CCTMXTiledMap.Create("TileMaps/iso-test-vertexz");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
            map.Position = new CCPoint(-s.Width / 2, 0);

            // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
            // can use any CCSprite and it will work OK.
            CCTMXLayer layer = map.LayerNamed("Trees");
            m_tamara = layer.TileAt(new CCPoint(29, 29));

            CCMoveBy move = new CCMoveBy (10, new CCPoint(300, 250) * (1f / CCMacros.CCContentScaleFactor()));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = CCSequence.FromActions(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            m_tamara.Position = new CCPoint(m_tamara.Position.X + 100, m_tamara.Position.Y + 100);

            Schedule(repositionSprite);
        }
Пример #39
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_background.Parent.RemoveChild(m_background, true);
            m_background = null;

            CCParallaxNode p = CCParallaxNode.Create();
            AddChild(p, 5);

            CCSprite p1 = new CCSprite(TestResource.s_back3);
            CCSprite p2 = new CCSprite(TestResource.s_back3);

            p.AddChild(p1, 1, new CCPoint(0.5f, 1), new CCPoint(0, 250));
            p.AddChild(p2, 2, new CCPoint(1.5f, 1), new CCPoint(0, 50));

            m_emitter = CCParticleFlower.Create();

            m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire);

            p1.AddChild(m_emitter, 10);
            m_emitter.Position = new CCPoint(250, 200);

            CCParticleSun par = CCParticleSun.Create();
            p2.AddChild(par, 10);
            par.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire);

            CCActionInterval move = new CCMoveBy (4, new CCPoint(300, 0));
            CCFiniteTimeAction move_back = move.Reverse();
            CCFiniteTimeAction seq = CCSequence.FromActions(move, move_back);
            p.RunAction(new CCRepeatForever ((CCActionInterval) seq));
        }
Пример #40
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(3);

            var s = CCDirector.SharedDirector.WinSize;

            var actionTo = new CCMoveTo (2, new CCPoint(s.Width - 40, s.Height - 40));
            var actionBy = new CCMoveBy (2, new CCPoint(80, 80));
            var actionByBack = actionBy.Reverse();

            m_tamara.RunAction(actionTo);
            m_grossini.RunAction(CCSequence.FromActions(actionBy, actionByBack));
            m_kathia.RunAction(new CCMoveTo (1, new CCPoint(40, 40)));
        }