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

            Color = CCColor3B.Blue;
            Opacity = 255;

            // Make sure we set the Opacity to cascade or fadein action will not work correctly.
            Target1.IsOpacityCascaded = true;
            Target2.IsOpacityCascaded = true;

            // Define actions
            var moveUp = new CCMoveBy(1.0f, new CCPoint(0.0f, 50.0f));
            var moveDown = moveUp.Reverse();

            // A CCSequence action runs the list of actions in ... sequence!
            var moveSeq = new CCSequence(new CCEaseBackInOut(moveUp), new CCEaseBackInOut(moveDown));

            var repeatedAction = new CCRepeatForever(moveSeq);

            // A CCSpawn action runs the list of actions concurrently
            var dreamAction = new CCSpawn(new CCFadeIn(5.0f), new CCWaves(5.0f, new CCGridSize(10, 20), 5, 20, true, false));


            Target1.RunActions(dreamAction, repeatedAction);

            Target2.RunActions(dreamAction, new CCDelayTime(0.5f), repeatedAction);

            // moving background. Testing issue #244
            var move = new CCMoveBy (3, new CCPoint(200, 0));

            bgNode.RepeatForever(move, move.Reverse());
        }
        public GameLayer()
            : base(CCColor4B.Blue, CCColor4B.AliceBlue)
        {
            // Set the layer gradient direction
            this.Vector = new CCPoint (0.5f, 0.5f);

            // Create and add sprites
            // We will later be applying a wave action to these sprites
            // These type of actions can only be applied to CCNodeGrid instances
            // Therefore, wrap our sprites in a CCNodeGrid parent
            monkeySprite1 = new CCNodeGrid ();
            monkeySprite1.AddChild (new CCSprite ("monkey"));
            AddChild (monkeySprite1);

            monkeySprite2 = new CCNodeGrid ();
            monkeySprite2.AddChild (new CCSprite ("monkey"));
            AddChild (monkeySprite2);

            // Define actions
            var moveUp = new CCMoveBy (1.0f, new CCPoint (0.0f, 50.0f));
            var moveDown = moveUp.Reverse ();

            // A CCSequence action runs the list of actions in ... sequence!
            CCSequence moveSeq = new CCSequence (new CCEaseBackInOut (moveUp), new CCEaseBackInOut (moveDown));

            repeatedAction = new CCRepeatForever (moveSeq);

            // A CCSpawn action runs the list of actions concurrently
            dreamAction = new CCSpawn (new CCFadeIn (5.0f), new CCWaves (5.0f, new CCGridSize (10, 20), 4, 4));

            // Schedule for method to be called every 0.1s
            Schedule (UpdateLayerGradient, 0.1f);
        }
Ejemplo n.º 3
0
        public GameLayer()
            : base(CCColor4B.Blue, CCColor4B.AliceBlue)
        {
            // Set the layer gradient direction
            this.Vector = new CCPoint(0.5f, 0.5f);

            // Create and add sprites
            monkeySprite1 = new CCSprite("monkey");
            AddChild(monkeySprite1, 1);

            monkeySprite2 = new CCSprite("monkey");
            AddChild(monkeySprite2, 1);

            // Define actions
            var moveUp = new CCMoveBy(1.0f, new CCPoint(0.0f, 50.0f));
            var moveDown = moveUp.Reverse();

            // A CCSequence action runs the list of actions in ... sequence!
            CCSequence moveSeq = new CCSequence(new CCEaseBackInOut(moveUp), new CCEaseBackInOut(moveDown));

            repeatedAction = new CCRepeatForever(moveSeq);

            // A CCSpawn action runs the list of actions concurrently
            dreamAction = new CCSpawn(new CCFadeIn(5.0f), new CCWaves(5.0f, new CCGridSize(10, 20), 4, 4));

            // Schedule for method to be called every 0.1s
            Schedule(UpdateLayerGradient, 0.1f);
        }
Ejemplo n.º 4
0
        public Test5()
        {
            CCSprite sp1 = new CCSprite(TestResource.s_pPathSister1);
            sp2 = new CCSprite(TestResource.s_pPathSister2);

            sp1.Position = (new CCPoint(100, 160));
            sp2.Position = (new CCPoint(380, 160));

			var rot = new CCRotateBy (2, 360);
            var rot_back = rot.Reverse();

			var forever = new CCRepeatForever (rot, rot_back) { Tag = 101 };

			// Since Actions are immutable to set the tag differently we need to 
			// create a new action.  Notice that the same actions can be used in
			// this case instead of copying them as well.
			forever2 = new CCRepeatForever (rot, rot_back) { Tag = 102 };
            
            AddChild(sp1, 0, CocosNodeTestStaticLibrary.kTagSprite1);
            AddChild(sp2, 0, CocosNodeTestStaticLibrary.kTagSprite2);

            RemoveChild(sp2, true);
            AddChild(sp2, 0, CocosNodeTestStaticLibrary.kTagSprite2);

            // Sprite 1 should run and run
            // Sprite 2 should stop
            sp1.RunAction(forever);
            sp2.RunAction(forever2);

            // Experiment with removing sp2 and re-adding it after cleanup to reproduce an error in child management
			//ScheduleOnce(Stage2OfTest, 2.0f);
			Schedule(addAndRemove, 2.0f);
        }
Ejemplo n.º 5
0
        public Test6()
        {
            CCSprite sp1 = new CCSprite(TestResource.s_pPathSister1);
            CCSprite sp11 = new CCSprite(TestResource.s_pPathSister1);

            CCSprite sp2 = new CCSprite(TestResource.s_pPathSister2);
            CCSprite sp21 = new CCSprite(TestResource.s_pPathSister2);

            sp1.Position = (new CCPoint(100, 160));
            sp2.Position = (new CCPoint(380, 160));

            CCFiniteTimeAction rot = new CCRotateBy (2, 360);
            var rot_back = rot.Reverse();
			var forever1 = new CCRepeatForever (rot, rot_back);

            AddChild(sp1, 0, CocosNodeTestStaticLibrary.kTagSprite1);
            sp1.AddChild(sp11);
            AddChild(sp2, 0, CocosNodeTestStaticLibrary.kTagSprite2);
            sp2.AddChild(sp21);

            sp1.RunAction(forever1);
            sp11.RunAction(forever1);
			sp2.RunAction(forever1);
            sp21.RunAction(forever1);

            Schedule(addAndRemove, 2.0f);
        }
Ejemplo n.º 6
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);
        }
        public SpriteBatchNodeChildrenChildren()
        {
            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("animations/ghosts.plist");

            var rot = new CCRotateBy (10, 360);
            seq = new CCRepeatForever (rot);

            var rot_back = rot.Reverse();
            rot_back_fe = new CCRepeatForever (rot_back);

            // SpriteBatchNode: 3 levels of children

            aParent = new CCSpriteBatchNode("animations/ghosts");
            AddChild(aParent);

            // parent
            l1 = new CCSprite("father.gif");
            aParent.AddChild(l1);


            // child left
            l2a = new CCSprite("sister1.gif");

            l1.AddChild(l2a);

            // child right
            l2b = new CCSprite("sister2.gif");

            l1.AddChild(l2b);


            // child left bottom
            l3a1 = new CCSprite("child1.gif");
            l3a1.Scale = 0.45f;
            l2a.AddChild(l3a1);

            // child left top
            l3a2 = new CCSprite("child1.gif");
            l3a2.Scale = 0.45f;
            l2a.AddChild(l3a2);

            // child right bottom
            l3b1 = new CCSprite("child1.gif");
            l3b1.Scale = 0.45f;
            l3b1.FlipY = true;
            l2b.AddChild(l3b1);

            // child right top
            l3b2 = new CCSprite("child1.gif");
            l3b2.Scale = 0.45f;
            l3b2.FlipY = true;
            l2b.AddChild(l3b2);
        }
Ejemplo n.º 8
0
        public Player()
        {
            CCSpriteSheet tmp = new CCSpriteSheet("poring.plist");

            //List<CCSpriteFrame> elementos = new List<CCSpriteFrame>();
            //for (int i = 1; i <= 3; i++)
            //{
            //    tmp = CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName(String.Format("walk{0}.png", i));
            //    elementos.Add(tmp);
            //}
            CCAnimation anim = new CCAnimation(tmp.Frames, 0.5f);
            CCRepeatForever rep = new CCRepeatForever(new CCAnimate(anim));
            RunAction(rep);
        }
        public SpriteBatchNodeChildrenScale()
        {
            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("animations/grossini_family.plist");

            var rot = new CCRotateBy (10, 360);

            seq = new CCRepeatForever(rot);

            // Children + Scale using Sprite
            // Test 1
            aParent = new CCNode();
            sprite1 = new CCSprite("grossinis_sister1.png");
            sprite2 = new CCSprite("grossinis_sister2.png");

            AddChild(aParent);
            aParent.AddChild(sprite1);
            sprite1.AddChild(sprite2);

            // Children + Scale using SpriteBatchNode
            // Test 2
            aParent2 = new CCSpriteBatchNode("animations/grossini_family");
            sprite3 = new CCSprite("grossinis_sister1.png");
            sprite4 = new CCSprite("grossinis_sister2.png");
            sprite4.Position = (new CCPoint(50, 0));

            AddChild(aParent2);
            aParent2.AddChild(sprite3);
            sprite3.AddChild(sprite4);

            // Children + Scale using Sprite
            // Test 3
            aParent3 = new CCNode ();
            sprite5 = new CCSprite("grossinis_sister1.png");
            sprite6 = new CCSprite("grossinis_sister2.png");

            AddChild(aParent3);
            aParent3.AddChild(sprite5);
            sprite5.AddChild(sprite6);

            // Children + Scale using Sprite
            // Test 4
            aParent4 = new CCSpriteBatchNode("animations/grossini_family");
            sprite7 = new CCSprite("grossinis_sister1.png");
            sprite8 = new CCSprite("grossinis_sister2.png");

            AddChild(aParent4);
            aParent4.AddChild(sprite7);
            sprite7.AddChild(sprite8);
        }
Ejemplo n.º 10
0
        void InitialiseTileAnimations()
        {
            currentTileGidAnimations        = new Dictionary <short, short>();
            activeTileAnimationActionStates = new List <CCActionState>();

            var tileAnimDict = mapInfo.TileAnimations;

            TileAnimations = new Dictionary <short, CCRepeatForever>();

            foreach (short gid in tileAnimDict.Keys)
            {
                var repeatAction = new CCRepeatForever(new CCTileAnimation(gid, tileAnimDict[gid]));
                TileAnimations.Add(gid, repeatAction);
            }
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // 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 = new CCMotionStreak(2, 3, 32, CCColor3B.Green, 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 ((CCFiniteTimeAction)new CCSequence(motion, motion.Reverse())));
            m_root.RunAction(action1);

            var colorAction = new CCRepeatForever ((CCFiniteTimeAction)
                new CCSequence(
                    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);
        }
        public SpriteBatchNodeAnchorPoint()
        {
            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            CCRotateBy rotate = new CCRotateBy(10, 360);
            action = new CCRepeatForever(rotate);

            // Small capacity. Testing resizing.
            // Don't use capacity=1 in your real game. It is expensive to resize the capacity
            CCSpriteBatchNode batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 1);
            AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);

            for (int i = 0; i < numOfSprites; i++)
            {
                CCSprite sprite = new CCSprite(batch.Texture, new CCRect(85, 121 * 1, 85, 121));
                batch.AddChild(sprite, i);

                CCSprite point = new CCSprite("Images/r1");
                AddChild(point, 10);

                switch(i)
                {
                    case 0:
                        sprite.AnchorPoint = (new CCPoint(0, 0));
                        break;
                    case 1:
                        sprite.AnchorPoint = (new CCPoint(0.5f, 0.5f));
                        break;
                    case 2:
                        sprite.AnchorPoint = (new CCPoint(1, 1));
                        break;
                }

                point.Position = sprite.Position;

                sprites[i] = sprite;
                pointSprites[i] = point;
            }
        }
Ejemplo n.º 16
0
        public LabelAtlasColorTest()
        {
            CCLabelAtlas label1 = new CCLabelAtlas("123 Test", "fonts/tuffy_bold_italic-charmap", 48, 64, ' ');
            AddChild(label1, 0, (int)TagSprite.kTagSprite1);
            label1.Position = new CCPoint(10, 100);
            label1.Opacity = 200;

            CCLabelAtlas label2 = new CCLabelAtlas("0123456789", "fonts/tuffy_bold_italic-charmap", 48, 64, ' ');
            AddChild(label2, 0, (int)TagSprite.kTagSprite2);
            label2.Position = new CCPoint(10, 200);
            label2.Color = ccRED;

            CCFiniteTimeAction fade = new CCFadeOut  (1.0f);
            CCFiniteTimeAction fade_in = fade.Reverse();
            CCFiniteTimeAction seq = new CCSequence(fade, fade_in);
            CCAction repeat = new CCRepeatForever ((CCFiniteTimeAction)seq);
            label2.RunAction(repeat);

            m_time = 0;

            Schedule(step); //:@selector(step:)];
        }
Ejemplo n.º 17
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);
            }
        }
Ejemplo n.º 18
0
        public SpriteAnchorPoint()
        {
            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            CCRotateBy rotate = new CCRotateBy(10, 360);
            action = new CCRepeatForever(rotate);


            for (int i = 0; i < numOfSprites; i++)
            {
                CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(85, 121 * 1, 85, 121));
                AddChild(sprite, i);

                CCSprite point = new CCSprite("Images/r1");
                AddChild(point, 10);

                switch (i)
                {
                    case 0:
                        sprite.AnchorPoint = (new CCPoint(0, 0));
                        break;
                    case 1:
                        sprite.AnchorPoint = (new CCPoint(0.5f, 0.5f));
                        break;
                    case 2:
                        sprite.AnchorPoint = (new CCPoint(1, 1));
                        break;
                }

                point.Position = sprite.Position;

                sprites[i] = sprite;
                pointSprites[i] = point;
            }
        }
Ejemplo n.º 19
0
 public TMXLargeMapScalingTest() : base("TileMaps/large_map")
 {
     var action = new CCRepeatForever(new CCSequence(new CCScaleTo(2.0f, 0.5f), new CCScaleTo(2.0f, 2f)));
     tileLayersContainer.RunAction(action);
 }
Ejemplo n.º 20
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float x = winSize.Width / 2;
            float y = 0 + (winSize.Height / 2);
            var rgba = new CCLayer();
            rgba.IsColorCascaded = true;
            rgba.IsOpacityCascaded = true;
            AddChild(rgba);

            CCLog.Log("S9CascadeOpacityAndColor ...");

            var blocks_scaled_with_insets = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");
            CCLog.Log("... created");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            rgba.AddChild(blocks_scaled_with_insets);
            var actions = new CCSequence(new CCFadeIn(1),
                                         new CCTintTo(1, 0, 255, 0),
                                         new CCTintTo(1, 255, 255, 255),
                                         new CCFadeOut(1));
            var repeat = new CCRepeatForever(actions);
            rgba.RunAction(repeat);
            CCLog.Log("AddChild");

            CCLog.Log("... S9CascadeOpacityAndColor done.");
        }
Ejemplo n.º 21
0
 public CCRepeatForeverState(CCRepeatForever action, CCNode target)
     : base(action, target)
 {
     InnerAction      = action.InnerAction;
     InnerActionState = (CCFiniteTimeActionState)InnerAction.StartAction(target);
 }
Ejemplo 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();
        }
Ejemplo n.º 23
0
        void AddMonkey()
        {
            var spriteSheet = new CCSpriteSheet ("animations/monkey.plist");
            var animationFrames = spriteSheet.Frames.FindAll ((x) => x.TextureFilename.StartsWith ("frame"));

            walkAnim = new CCAnimation (animationFrames, 0.1f);
            walkRepeat = new CCRepeatForever (new CCAnimate (walkAnim));
            monkey = new CCSprite (animationFrames.First ()) { Name = "Monkey" };
            monkey.Scale = 0.25f;

            AddChild (monkey);
        }
Ejemplo n.º 24
0
        public ActionOrbit()
        {
            var orbit1 = new CCOrbitCamera(2, 1, 0, 0, 180, 0, 0);
            action1 = new CCSequence(orbit1,orbit1.Reverse());

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

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

            var move = new CCMoveBy (3, new CCPoint(100, -100));
            var move_back = move.Reverse();
            var seq = new CCSequence(move, move_back);
            rfe = new CCRepeatForever (seq);
        }
Ejemplo n.º 25
0
        public override void OnEnter()
        {

            base.OnEnter(); 

            CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            CenterSprites(1);

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

            Grossini.RunAction(rep);

            RunAction(new CCFollow (Grossini, new CCRect(0, 0, windowSize.Width * 2 - 100, windowSize.Height)));
        }
Ejemplo n.º 26
0
 public CCRepeatForeverState (CCRepeatForever action, CCNode target)
     : base (action, target)
 { 
     InnerAction = action.InnerAction;
     InnerActionState = (CCFiniteTimeActionState)InnerAction.StartAction (target);
 }
Ejemplo n.º 27
0
 public ActionRepeatForever()
 {
     action = new CCSequence(new CCDelayTime (1), new CCCallFuncN(RepeatForever));
     repeat = new CCRepeatForever(new CCRotateBy(1.0f, 360));
 }
Ejemplo n.º 28
0
        public override void OnEnter()
        {
            base.OnEnter(); 

            CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            CenterSprites(3);

            // sprite 1
            CCBezierConfig bezier;
            bezier.ControlPoint1 = new CCPoint(0, windowSize.Height / 2);
            bezier.ControlPoint2 = new CCPoint(300, -windowSize.Height / 2);
            bezier.EndPosition = new CCPoint(300, 100);

            var bezierForward = new CCBezierBy(3, bezier);
            var bezierBack = bezierForward.Reverse();
            var rep = new CCRepeatForever (bezierForward, bezierBack);


            // sprite 2
            Tamara.Position = new CCPoint(80, 160);
            CCBezierConfig bezier2;
            bezier2.ControlPoint1 = new CCPoint(100, windowSize.Height / 2);
            bezier2.ControlPoint2 = new CCPoint(200, -windowSize.Height / 2);
            bezier2.EndPosition = new CCPoint(240, 160);

            var bezierTo1 = new CCBezierTo (2, bezier2);

            // sprite 3
            Kathia.Position = new CCPoint(400, 160);
            var bezierTo2 = new CCBezierTo (2, bezier2);

            Grossini.RunAction(rep);
            Tamara.RunAction(bezierTo1);
            Kathia.RunAction(bezierTo2);
        }
Ejemplo n.º 29
0
        public ActionRotateToRepeat()
        {
            var act1 = new CCRotateTo(1, 90);
            var act2 = new CCRotateTo(1, 0);
            var seq = new CCSequence(act1, act2);

            rep1 = new CCRepeatForever(seq);
            rep2 = new CCRepeat(seq, 10);
        }
Ejemplo n.º 30
0
        public ActionTargeted()
        {
            var jump1 = new CCJumpBy(2, CCPoint.Zero, 100, 3);
            var rot1 = new CCRotateBy(1, 360);

            var t1 = new CCTargetedAction (Kathia, jump1);
            var t2 = new CCTargetedAction (Kathia, rot1);


            var seq = new CCSequence(jump1, t1, rot1, t2);
            always = new CCRepeatForever (seq);
        }
Ejemplo n.º 31
0
        public override void RunActionsInSprite(CCSprite sprite)
        {
            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // sprite 1
            CCBezierConfig bezier;
            bezier.ControlPoint1 = new CCPoint(0, s.Height / 2);
            bezier.ControlPoint2 = new CCPoint(300, -s.Height / 2);
            bezier.EndPosition = new CCPoint(300, 100);

            CCBezierBy bezierForward = new CCBezierBy(3, bezier);
            CCBezierBy bezierBack = (CCBezierBy) bezierForward.Reverse();
            CCSequence seq = new CCSequence(bezierForward, bezierBack);
            CCRepeatForever rep = new CCRepeatForever(seq);
            sprite.RunAction(rep);

            sprite.RunAction(
                new CCRepeatForever(
                    new CCSequence(
                        new CCMoveBy(0.05f, new CCPoint(10, 0)),
                        new CCMoveBy(0.05f, new CCPoint(-10, 0))
                    )
                )
            );
        }
Ejemplo n.º 32
0
        public ActionRotateJerk()
        {
            var seq = new CCSequence(
                new CCRotateTo (0.5f, -20),
                new CCRotateTo (0.5f, 20));

            rep1 = new CCRepeat (seq, 10);
            rep2 = new CCRepeatForever (seq);
        }