Beispiel #1
0
        protected override void Init(World world)
        {
            Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
            body1.SetPosition(250.0f, 400);
            world.Add(body1);
            Body body1b = new StaticBody("Ground1", new Box(20.0f, 400.0f));
            body1b.SetPosition(20.0f, 200);
            world.Add(body1b);

            Body body3 = new Body("Mover2", new Circle(25), 50.0f);
            body3.SetPosition(225.0f, 365);
            world.Add(body3);
            Body body2 = new Body("Mover1", new Circle(25), 50.0f);
            body2.SetPosition(275.0f, 365);
            world.Add(body2);
            Body body3a = new Body("Mover2", new Circle(25), 50.0f);
            body3a.SetPosition(175.0f, 365);
            world.Add(body3a);
            Body body2a = new Body("Mover1", new Circle(25), 50.0f);
            body2a.SetPosition(325.0f, 365);
            world.Add(body2a);

            Body faller = new Body("Faller", new Circle(25), 200.0f);
            faller.SetPosition(250.0f, -20f);
            world.Add(faller);
        }
Beispiel #2
0
        protected override void Init(World world)
        {
            float w = 50f;
            Body body1 = new StaticBody("Ground1", new Box(w,w));

            body1.SetPosition(250.0f, 400);
            world.Add(body1);
            Body body3 = new StaticBody("Ground2", new Box(w,w));
            body3.SetPosition(360.0f, 380);
            world.Add(body3);
            Body body5 = new StaticBody("Ground3", new Box(w,w));
            body5.SetPosition(200.0f, 300);
            world.Add(body5);
            Body body6 = new StaticBody("Ground3", new Box(w,w));
            body6.SetPosition(400.0f, 300);
            world.Add(body6);

            Body body2 = new Body("Mover1", new Box(w, w), 100.0f);
            body2.SetPosition(250.0f, 4.0f);
            world.Add(body2);
            Body body4 = new Body("Mover2", new Box(w,w), 100.0f);
            body4.SetPosition(230.0f, -60.0f);
            world.Add(body4);
            Body body8 = new Body("Mover3", new Box(w, w), 100.0f);
            body8.SetPosition(280.0f, -120.0f);
            world.Add(body8);
        }
Beispiel #3
0
        protected override void Init(World world)
        {
            Body body1 = new StaticBody("Ground1", new Box(500.0f, 20.0f));
            body1.SetPosition(250.0f, 400);
            world.Add(body1);

            Body body2 = new Body("Teeter", new Box(250.0f, 10.0f), 5);
            body2.Friction = 0.5f;
            body2.SetPosition(250.0f, 370);
            world.Add(body2);

            Body body3 = new Body("light1", new Box(10.0f, 10.0f), 10);
            body3.SetPosition(135, 360);
            world.Add(body3);
            Body body4 = new Body("light2", new Box(10.0f, 10.0f), 10);
            body4.SetPosition(150, 360);
            world.Add(body4);

            Body body5 = new Body("weight", new Box(25.0f, 25.0f), 30);
            body5.SetPosition(350, 50);
            world.Add(body5);

            BasicJoint j = new BasicJoint(body1, body2, new Vector2f(250, 370));
            world.Add(j);
        }
Beispiel #4
0
        protected override void Init(World world)
        {
            Body body1 = new StaticBody("Ground1", new Box(600.0f, 20.0f));
            body1.SetPosition(250.0f, 400);
            world.Add(body1);
            Body body3 = new StaticBody("Ground2", new Box(200.0f, 20.0f));
            body3.SetPosition(360.0f, 340);
            body3.Rotation = 0.4f;
            world.Add(body3);
            Body body9 = new StaticBody("Ground3", new Box(200.0f, 20.0f));
            body9.SetPosition(140.0f, 340);
            body9.Rotation = - 0.4f;
            world.Add(body9);
            Body bodya = new StaticBody("Wall1", new Box(20.0f, 400.0f));
            bodya.SetPosition(20.0f, 190);
            world.Add(bodya);
            Body bodyb = new StaticBody("Wall2", new Box(20.0f, 400.0f));
            bodyb.SetPosition(480.0f, 190);
            world.Add(bodyb);

            Body body2 = new Body("Mover1", new Box(50.0f, 50.0f), 100.0f);
            body2.SetPosition(250.0f, 4.0f);
            body2.Rotation = 0.2f;
            world.Add(body2);
            Body body4 = new Body("Mover2", new Box(50.0f, 50.0f), 100.0f);
            body4.SetPosition(230.0f, - 60.0f);
            world.Add(body4);
            Body body8 = new Body("Mover3", new Box(50.0f, 50.0f), 100.0f);
            body8.SetPosition(280.0f, - 120.0f);
            world.Add(body8);
        }
Beispiel #5
0
        protected override void Init(World world)
        {
            this.world = world;

            Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
            body1.SetPosition(250.0f, 400);
            body1.Friction = 1;
            world.Add(body1);

            for (int y = 0; y < 5; y++)
            {
                int xbase = 250 - (y * 21);
                for (int x = 0; x < y + 1; x++)
                {
                    DynamicShape shape = new Box(40, 40);
                    if ((x == 1) && (y == 2))
                    {
                        shape = new Circle(19);
                    }
                    if ((x == 1) && (y == 4))
                    {
                        shape = new Circle(19);
                    }
                    if ((x == 3) && (y == 4))
                    {
                        shape = new Circle(19);
                    }
                    Body body2 = new Body("Mover1", shape, 100.0f);
                    body2.SetPosition(xbase + (x * 42), y * 45);
                    world.Add(body2);
                }
            }
        }
Beispiel #6
0
        protected override void Init(World world)
        {
            Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
            body1.SetPosition(250.0f, 400);
            body1.Friction = 1;
            world.Add(body1);

            for (int y = 0; y < 3; y++)
            {
                int xbase = 250 - (y * 21);
                for (int x = 0; x < y + 1; x++)
                {
                    Body body2 = new Body("Mover1", new Box(40.0f, 40.0f), 100.0f);
                    body2.SetPosition(xbase + (x * 42), y * 45);
                    world.Add(body2);
                }
            }
        }
Beispiel #7
0
        protected override void Init(World world)
        {
            Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
            body1.SetPosition(250.0f, 400);
            world.Add(body1);
            Body body3 = new StaticBody("Ground2", new Box(200.0f, 20.0f));
            body3.SetPosition(250.0f, 100);
            world.Add(body3);

            Body swing = new Body("Swing", new Circle(10), 50);
            swing.SetPosition(160.0f, 300);
            world.Add(swing);
            Body swing2 = new Body("Swing", new Circle(10), 50);
            swing2.SetPosition(340.0f, 300);
            world.Add(swing2);
            Body swing3 = new Body("Swing", new Box(250.0f, 10.0f), 50);
            swing3.SetPosition(250.0f, 285);
            swing3.Friction = 4.0f;
            world.Add(swing3);

            Body box = new Body("Resting", new Box(30, 30), 1);
            box.SetPosition(250.0f, 200);
            box.Rotation = 0.15f;
            world.Add(box);

            BasicJoint j1 = new BasicJoint(body3, swing, new Vector2f(160, 110));
            world.Add(j1);
            BasicJoint j2 = new BasicJoint(body3, swing2, new Vector2f(340, 110));
            world.Add(j2);
            BasicJoint j3 = new BasicJoint(swing, swing3, new Vector2f(160, 300));
            world.Add(j3);
            BasicJoint j4 = new BasicJoint(swing2, swing3, new Vector2f(340, 300));
            world.Add(j4);

            swing.AdjustVelocity(new Vector2f(-100, 0));
        }
Beispiel #8
0
        protected override void Init(World world)
        {
            Body body;
            BasicJoint j;

            Body ground1 = new StaticBody("Ground1", new Box(500.0f, 20.0f));
            ground1.SetPosition(250.0f, 400);
            world.Add(ground1);

            body = new StaticBody("Ground2", new Box(250.0f, 20.0f));
            body.SetPosition(225.0f, 200);
            body.Friction = 3.0f;
            world.Add(body);

            // pendulum
            body = new StaticBody("Pen1", new Box(20.0f, 20.0f));
            body.SetPosition(70.0f, 100);
            world.Add(body);
            ball = new Body("Ball", new Box(10.0f, 10.0f), 1000);
            ball.SetPosition(70.0f, 170);
            world.Add(ball);

            j = new BasicJoint(body, ball, new Vector2f(70, 110));
            world.Add(j);

            // dominos
            for (int i = 0; i < 8; i++)
            {
                body = new Body("Domino " + i, new Box(10.0f, 40.0f), 10 - i);
                body.SetPosition(120.0f + (i * 30), 170);
                world.Add(body);
            }

            // ramp
            body = new StaticBody("Ground2", new Box(200.0f, 10.0f));
            body.SetPosition(345.0f, 270);
            body.Rotation = -0.6f;
            body.Friction = 0;
            world.Add(body);

            // teeter
            body = new Body("Teete", new Box(250.0f, 10.0f), 10);
            body.SetPosition(250.0f, 360);
            //body.setFriction(3.0f);
            world.Add(body);
            j = new BasicJoint(body, ground1, new Vector2f(250, 360));
            world.Add(j);

            // turner
            body = new Body("Turner", new Box(40.0f, 40.0f), 0.1f);
            body.SetPosition(390.0f, 330);
            body.Friction = 0f;
            world.Add(body);
            j = new BasicJoint(ground1, body, new Vector2f(390, 335));
            world.Add(j);
            Body top = new Body("Top", new Box(40.0f, 5.0f), 0.01f);
            top.SetPosition(390.0f, 307.5f);
            top.Friction = 0f;
            world.Add(top);
            j = new BasicJoint(top, body, new Vector2f(410, 310));
            world.Add(j);
        }