Пример #1
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));
            var act2 = (CCMoveBy) act1.Reverse();
            var act3 = new CCSequence(act1, act2);
            var act4 = new CCRepeat (act3, 2);

            spr.RunAction(act4);
        }
Пример #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            alignSpritesLeft(2);

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

            m_kathia.RunAction(action1);
            m_tamara.RunAction(action2);
        }
Пример #3
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 = new CCSequence(move1, tog1, move2, tog2, move1.Reverse());
            var action = new CCRepeat ((new CCSequence(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 = new CCSequence(move_tamara, hide, move_tamara2);
            var seq_back = seq_tamara.Reverse();
            m_tamara.RunAction(new CCSequence(seq_tamara, seq_back));
        }
Пример #4
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            var seq = new CCSequence(
                new CCRotateTo (0.5f, -20),
                new CCRotateTo (0.5f, 20));

            var rep1 = new CCRepeat (seq, 10);
            var rep2 = new CCRepeatForever ((CCActionInterval)(seq.Copy()));

            m_tamara.RunAction(rep1);
            m_kathia.RunAction(rep2);
        }
Пример #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            var act1 = new CCRotateTo (1, 90);
            var act2 = new CCRotateTo (1, 0);
            var seq = (new CCSequence(act1, act2));
            var rep1 = new CCRepeatForever ((CCActionInterval)seq);
            var rep2 = new CCRepeat ((CCFiniteTimeAction)(seq.Copy()), 10);

            m_tamara.RunAction(rep1);
            m_kathia.RunAction(rep2);
        }
        /// <summary>
        /// Creates a sequence of actions that causes a sprite to jump on the screen.
        /// </summary>
        /// <param name="repeatForever">A boolean value that determines if the action should be repeated indefinitely.</param>
        /// <returns></returns>
        internal static CCFiniteTimeAction JumpAction(bool repeatForever)
        {
            // Create an action to jump the active sprite from it's current position
            CCActionInterval jumpAction = new CCJumpBy(0.3f, new CCPoint(150, 0), 100, 1);

            // Setup an action sequence to perform the jump action, then reverse it
            jumpAction = new CCSequence(jumpAction, jumpAction.Reverse());

            // Repeat the jump sequence three times, just for fun
            jumpAction = new CCRepeat(jumpAction, 3);

            // If necessary, repeat the jump actions above indefinitely
            if (repeatForever) jumpAction = new CCRepeatForever(jumpAction);

            return jumpAction;
        }