Example #1
0
        /** creates an action with a Cardinal Spline array of points and tension */
        public static CCCatmullRomTo create(float dt, CCPointArray points)
        {
            CCCatmullRomTo ret = new CCCatmullRomTo();

            ret.initWithDuration(dt, points);
            return(ret);
        }
Example #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            var s = CCDirector.SharedDirector.WinSize;

            //
            // sprite 1 (By)
            //
            // startPosition can be any coordinate, but since the movement
            // is relative to the Catmull Rom curve, it is better to start with (0,0).
            //

            m_tamara.Position = new CCPoint(50, 50);

            m_pArray.Clear();

            m_pArray.Add(new CCPoint(0, 0));
            m_pArray.Add(new CCPoint(80, 80));
            m_pArray.Add(new CCPoint(s.Width - 80, 80));
            m_pArray.Add(new CCPoint(s.Width - 80, s.Height - 80));
            m_pArray.Add(new CCPoint(80, s.Height - 80));
            m_pArray.Add(new CCPoint(80, 80));
            m_pArray.Add(new CCPoint(s.Width / 2, s.Height / 2));

            var action  = new CCCatmullRomBy(3, m_pArray);
            var reverse = action.Reverse();

            CCFiniteTimeAction seq = CCSequence.FromActions(action, reverse);

            m_tamara.RunAction(seq);

            //
            // sprite 2 (To)
            //
            // The startPosition is not important here, because it uses a "To" action.
            // The initial position will be the 1st point of the Catmull Rom path
            //

            m_pArray2.Clear();

            m_pArray2.Add(new CCPoint(s.Width / 2, 30));
            m_pArray2.Add(new CCPoint(s.Width - 80, 30));
            m_pArray2.Add(new CCPoint(s.Width - 80, s.Height - 80));
            m_pArray2.Add(new CCPoint(s.Width / 2, s.Height - 80));
            m_pArray2.Add(new CCPoint(s.Width / 2, 30));

            var action2  = new CCCatmullRomTo(3, m_pArray2);
            var reverse2 = action2.Reverse();

            CCFiniteTimeAction seq2 = CCSequence.FromActions(action2, reverse2);

            m_kathia.RunAction(seq2);
        }
Example #3
0
 /** creates an action with a Cardinal Spline array of points and tension
  * @deprecated: This interface will be deprecated sooner or later.
  */
 public static CCCatmullRomTo actionWithDuration(float dt, CCPointArray points)
 {
     return(CCCatmullRomTo.create(dt, points));
 }