Exemple #1
0
        void CreateSceneContents()
        {
            BackgroundColor = UIColor.Black;
            ScaleMode       = SKSceneScaleMode.AspectFit;

            // Give the scene an edge and configure other physics info on the scene.
            var body = SKPhysicsBody.CreateEdgeLoop(Frame);

            body.CategoryBitMask    = Category.Edge;
            body.CollisionBitMask   = 0;
            body.ContactTestBitMask = 0;
            PhysicsBody             = body;

            PhysicsWorld.Gravity         = new CGVector(0, 0);
            PhysicsWorld.ContactDelegate = this;

            // In this sample, the positions of everything is hard coded. In an actual game, you might implement this in an archive that is loaded from a file.
            controlledShip = new ShipSprite(new CGPoint(100, 300));
            AddChild(controlledShip);

            // this ship isn't connected to any controls so it doesn't move, except when it collides with something.
            AddChild(new ShipSprite(new CGPoint(200, 300)));

            AddChild(new AsteroidNode(new CGPoint(100, 200)));
            AddChild(new PlanetNode(new CGPoint(300, 100)));
        }
        void CreateSceneContents()
        {
            BackgroundColor = UIColor.Black;
            ScaleMode       = SKSceneScaleMode.AspectFit;

            var body = SKPhysicsBody.CreateEdgeLoop(Frame);

            body.CategoryBitMask    = Category.Edge;
            body.CollisionBitMask   = 0;
            body.ContactTestBitMask = 0;
            PhysicsBody             = body;

            PhysicsWorld.Gravity         = new CGVector(0, 0);
            PhysicsWorld.ContactDelegate = new PhysicsDelegate(DidBeginContact);

            controlledShip = new ShipSprite(new CGPoint(100, 300));
            AddChild(controlledShip);
            AddChild(new ShipSprite(new CGPoint(200, 300)));
            AddChild(new AsteroidNode(new CGPoint(100, 200)));
            AddChild(new PlanetNode(new CGPoint(300, 100)));
        }
        void CreateSceneContents()
        {
            BackgroundColor = UIColor.Black;
            ScaleMode = SKSceneScaleMode.AspectFit;

            var body = SKPhysicsBody.BodyWithEdgeLoopFromRect (Frame);
            body.CategoryBitMask = Category.Edge;
            body.CollisionBitMask = 0;
            body.ContactTestBitMask = 0;
            PhysicsBody = body;

            PhysicsWorld.Gravity = new CGVector (0, 0);
            PhysicsWorld.ContactDelegate = new PhysicsDelegate (DidBeginContact);

            controlledShip = new ShipSprite (new PointF (100, 300));
            AddChild (controlledShip);
            AddChild (new ShipSprite (new PointF (200, 300)));
            AddChild (new AsteroidNode (new PointF (100, 200)));
            AddChild (new PlanetNode (new PointF (300, 100)));
        }
        void CreateSceneContents()
        {
            BackgroundColor = UIColor.Black;
            ScaleMode = SKSceneScaleMode.AspectFit;

            // Give the scene an edge and configure other physics info on the scene.
            var body = SKPhysicsBody.CreateEdgeLoop (Frame);
            body.CategoryBitMask = Category.Edge;
            body.CollisionBitMask = 0;
            body.ContactTestBitMask = 0;
            PhysicsBody = body;

            PhysicsWorld.Gravity = new CGVector (0, 0);
            PhysicsWorld.ContactDelegate = this;

            // In this sample, the positions of everything is hard coded. In an actual game, you might implement this in an archive that is loaded from a file.
            controlledShip = new ShipSprite (new CGPoint (100, 300));
            AddChild (controlledShip);

            // this ship isn't connected to any controls so it doesn't move, except when it collides with something.
            AddChild (new ShipSprite (new CGPoint (200, 300)));

            AddChild (new AsteroidNode (new CGPoint (100, 200)));
            AddChild (new PlanetNode (new CGPoint (300, 100)));
        }