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

            Scene.PhysicsWorld.Gravity = CCPoint.Zero;

            //Create a boundin box container room
            var node = new CCNode();
            node.PhysicsBody = CCPhysicsBody.CreateEdgeBox(Window.WindowSizeInPixels, 1.0f, CCPoint.Zero);
            node.Position = Window.WindowSizeInPixels.Center;
            AddChild(node);

            //drops a grosini sprite on center on window
            CCSprite sp1 = AddGrossiniAtPosition(Center);
            CCSprite sp2 = AddGrossiniAtPosition(Left + new CCPoint(50, 0));
            CCSprite sp3 = AddGrossiniAtPosition(Right + new CCPoint(20, 0));
            CCSprite sp4 = AddGrossiniAtPosition(LeftTop + new CCPoint(50, -50));

            sp1.PhysicsBody.Tag = DRAG_BODYS_TAG;
            sp2.PhysicsBody.Tag = DRAG_BODYS_TAG;
            sp3.PhysicsBody.Tag = DRAG_BODYS_TAG;
            sp4.PhysicsBody.Tag = DRAG_BODYS_TAG;

            var actionTo = new CCJumpTo(2, new CCPoint(100, 100), 50, 4);
            var actionBy = new CCJumpTo(2, new CCPoint(300, 0), 50, 4);
            var actionUp = new CCJumpTo(2, new CCPoint(0, 50), 80, 4);
            var actionByBack = actionBy.Reverse();
            var rotateBy = new CCRotateBy(2, 180);
            var rotateByBack = new CCRotateBy(2, -180);

            sp1.RunAction(new CCRepeatForever(actionUp));
            sp2.RunAction(new CCRepeatForever(actionBy, actionByBack));
            sp3.RunAction(actionTo);
            sp4.RunAction(new CCRepeatForever(rotateBy, rotateByBack));

            ToggleDebug();

            Schedule();
        }
Exemplo n.º 2
0
 public ActionJump()
 {
     actionTo = new CCJumpTo (2, new CCPoint(300, 300), 50, 4);
     actionBy = new CCJumpBy (2, new CCPoint(300, 0), 50, 4);
     actionUp = new CCJumpBy (2, new CCPoint(0, 0), 80, 4);
     actionByBack = (CCJumpBy)actionBy.Reverse();
 }