Ejemplo n.º 1
0
        void InitPhysics()
        {
            var s = CCDirector.SharedDirector.WinSize;

            space = new Space()
            {
                Gravity = new PointF(0, -300)
            };

            // bottom
            walls[0] = new SegmentShape(space.StaticBody, new PointF(0, 0), new PointF(s.Width, 0), 0f);
            // top
            walls[1] = new SegmentShape(space.StaticBody, new PointF(0, s.Height), new PointF(s.Width, s.Height), 0f);
            // left
            walls[2] = new SegmentShape(space.StaticBody, new PointF(0, 0), new PointF(0, s.Height), 0f);
            // right
            walls[3] = new SegmentShape(space.StaticBody, new PointF(s.Width, 0), new PointF(s.Width, s.Height), 0f);

            foreach (var shape in walls)
            {
                shape.Elasticity = 2f;
                shape.Friction   = 1f;
                space.AddStaticShape(shape);
            }
        }
Ejemplo n.º 2
0
        void InitPhysics()
        {
            var s = CCDirector.SharedDirector.WinSize;
            space = new Space() {Gravity = new PointF(0,-300)};

            // bottom
            walls[0] = new SegmentShape(space.StaticBody, new PointF(0,0), new PointF(s.Width, 0), 0f);
            // top
            walls[1] = new SegmentShape(space.StaticBody, new PointF(0,s.Height), new PointF(s.Width, s.Height), 0f);
            // left
            walls[2] = new SegmentShape(space.StaticBody, new PointF(0,0), new PointF(0, s.Height), 0f);
            // right
            walls[3] = new SegmentShape(space.StaticBody, new PointF(s.Width,0), new PointF(s.Width, s.Height), 0f);

            foreach(var shape in walls) {
                shape.Elasticity=2f;
                shape.Friction=1f;
                space.AddStaticShape(shape);
            }
        }