Пример #1
0
        public override void OnEnter()
        {
            base.OnEnter();

			var listener = new CCEventListenerTouchAllAtOnce();
			listener.OnTouchesMoved = onTouchesMoved;
			AddEventListener(listener); 

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // create the streak object and add it to the scene
            streak = new CCMotionStreak(3, 3, 64, CCColor3B.White, s_streak);
            AddChild(streak);

            streak.Position = (new CCPoint(s.Width / 2, s.Height / 2));
        }
Пример #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            // ask director the the window size
            CCSize size = Layer.VisibleBoundsWorldspace.Size;

            streak = new CCMotionStreak(2.0f, 1.0f, 50.0f, new CCColor3B(255, 255, 0), "Images/Icon");
            AddChild(streak);

            m_center = new CCPoint(size.Width / 2, size.Height / 2);
            m_fRadius = size.Width / 3f;
            m_fAngle = 0.0f;

            Schedule(onUpdate, 0);
        }
Пример #3
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);
        }