示例#1
0
        public override void OnEnter()
        {
            base.OnEnter(); 

            CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            CenterSprites(2);

            pointArray.Add(CCPoint.Zero);
            pointArray.Add(new CCPoint(windowSize.Width / 2 - 30, 0));
            pointArray.Add(new CCPoint(windowSize.Width / 2 - 30, windowSize.Height - 80));
            pointArray.Add(new CCPoint(0, windowSize.Height - 80));
            pointArray.Add(CCPoint.Zero);

            //
            // sprite 1 (By)
            //
            // Spline with no tension (tension==0)
            //

            var action = new CCCardinalSplineBy(3, pointArray, 0);
            var reverse = action.Reverse();

            var seq = new CCSequence(action, reverse);

            Tamara.Position = new CCPoint(50, 50);
            Tamara.RunAction(seq);

            Tamara.RunAction(
                new CCRepeatForever(
                    new CCSequence(
                        new CCMoveBy(0.05f, new CCPoint(10, 0)),
                        new CCMoveBy(0.05f, new CCPoint(-10, 0))
                    )
                )
            );
            //
            // sprite 2 (By)
            //
            // Spline with high tension (tension==1)
            //

            var action2 = new CCCardinalSplineBy(3, pointArray, 1);
            var reverse2 = action2.Reverse();

            var seq2 = new CCSequence(action2, reverse2);

            Kathia.Position = new CCPoint(windowSize.Width / 2, 50);
            Kathia.RunAction(seq2);

            Kathia.RunAction(
                new CCRepeatForever(
                    new CCSequence(
                        new CCMoveBy(0.05f, new CCPoint(10, 0)),
                        new CCMoveBy(0.05f, new CCPoint(-10, 0))
                    )
                )
            );

        }
示例#2
0
        public override void OnEnter()
        {
            base.OnEnter(); 

            CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            CenterSprites(2);

            pointList.Clear();

            pointList.Add(new CCPoint(0, 0));
            pointList.Add(new CCPoint(windowSize.Width / 2 - 30, 0));
            pointList.Add(new CCPoint(windowSize.Width / 2 - 30, windowSize.Height - 80));
            pointList.Add(new CCPoint(0, windowSize.Height - 80));
            pointList.Add(new CCPoint(0, 0));

            var action = new CCCardinalSplineBy (3, pointList, 0);
            var reverse = action.Reverse();

            var seq = new CCSequence(action, reverse);

            var action2 = new CCCardinalSplineBy (3, pointList, 1);
            var reverse2 = action2.Reverse();

            var seq2 = new CCSequence(action2, reverse2);

            Tamara.Position = new CCPoint(50, 50);
            Tamara.RunAction(seq);

            Kathia.Position = new CCPoint(windowSize.Width / 2, 50);
            Kathia.RunAction(seq2);
        }