protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(50, 0)); List <Body> bodies = new List <Body>(); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(250, 0), bodies); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); DemoHelper.AddFloor(DemoInfo, new ALVector2D(0, new Vector2D(700, 750))); IShape shape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("fighter.png"), 3, 16, 4); for (int i = 128 * 3; i > -128; i -= 128) { Body b = DemoHelper.AddShape(DemoInfo, shape, 40, new ALVector2D(1, new Vector2D(700, 272 + i))); //b.Transformation *= Matrix2x3.FromScale(new Vector2D(1, .5f)); } Body line = DemoHelper.AddLine(DemoInfo, new Vector2D(300, 400), new Vector2D(600, 400), 20, Scalar.PositiveInfinity); line.IgnoresGravity = true; GroupedOneWayPlatformIgnorer ignorer = new GroupedOneWayPlatformIgnorer(-Vector2D.YAxis, 10); ignorer.AddGroup(bodies.ToArray()); line.CollisionIgnorer = ignorer; Body ball = DemoHelper.AddCircle(DemoInfo, 80, 20, 4000, new ALVector2D(0, 1028, 272)); ball.Transformation *= Matrix2x3.FromRotationZ(1) * Matrix2x3.FromScale(new Vector2D(.9f, .5f)) * Matrix2x3.FromRotationZ(-1); }
protected override void Open() { Coefficients coefficients = DemoHelper.Coefficients; DemoHelper.Coefficients.Restitution = 0; dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(50, 0)); dispose += DemoHelper.BasicDemoSetup(DemoInfo); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); DemoHelper.AddFloor(DemoInfo, new ALVector2D(0, new Vector2D(700, 750))); IShape piston = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("piston.png"), 0, 16, 1); IShape socket = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("socket.png"), 0, 16, 1); DemoHelper.AddShape(DemoInfo, piston, 10, new ALVector2D(0, 300, 300)); DemoHelper.AddShape(DemoInfo, socket, 10, new ALVector2D(0, 300, 300)); IShape fighter = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("fighter.png"), 3, 16, 3); DemoHelper.AddShape(DemoInfo, fighter, 50, new ALVector2D(0, 500, 300)); DemoHelper.AddShape(DemoInfo, fighter, 50, new ALVector2D(0, 500, 100)); IShape starfury = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("Starfury.png"), 3, 16, 3); DemoHelper.AddShape(DemoInfo, starfury, 50, new ALVector2D(0, 700, 300)); DemoHelper.AddShape(DemoInfo, starfury, 50, new ALVector2D(0, 700, 100)); Body ball = DemoHelper.AddCircle(DemoInfo, 80, 20, 4000, new ALVector2D(0, 1028, 272));// //AddShape(new CircleShape(80, 20), 4000, new ALVector2D(0, new Vector2D(1028, 272))); DemoHelper.Coefficients = coefficients; }
protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(50, 0)); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); DemoHelper.AddFloor(DemoInfo, new ALVector2D(0, new Vector2D(700, 750))); IShape shape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("block.png"), 3, 7, 4); DemoHelper.AddGrid( DemoInfo, shape, 20, new BoundingRectangle(440, 450, 500, 730), 1, 1); Body ball = DemoHelper.AddCircle(DemoInfo, 80, 20, 4000, new ALVector2D(0, 1028, 272)); Vector2D[][] polygons1 = new Vector2D[2][]; polygons1[0] = VertexHelper.Subdivide(VertexHelper.CreateRectangle(50, 50), 16); polygons1[1] = VertexHelper.CreateCircle(30, 20); Matrix2x3 matrix = Matrix2x3.FromTransformation(1, new Vector2D(30, 50)); polygons1[0] = VertexHelper.ApplyMatrix(ref matrix, polygons1[0]); IShape shape1 = ShapeFactory.CreateColoredMultiPolygon(polygons1, 3); DemoHelper.AddShape(DemoInfo, shape1, 50, new ALVector2D(0, 300, 300)); Vector2D[][] polygons = new Vector2D[3][]; polygons[0] = VertexHelper.Subdivide(VertexHelper.CreateRectangle(30, 50), 16); polygons[1] = VertexHelper.Subdivide(VertexHelper.CreateRectangle(50, 70), 16); polygons[2] = VertexHelper.CreateCircle(30, 20); matrix = Matrix2x3.FromTransformation(6, new Vector2D(36, 50)); polygons[2] = VertexHelper.ApplyMatrix(ref matrix, polygons[2]); matrix = Matrix2x3.FromTransformation(-6, new Vector2D(-36, 50)); polygons[1] = VertexHelper.ApplyMatrix(ref matrix, polygons[1]); IShape shape2 = ShapeFactory.CreateColoredMultiPolygon(polygons, 3); DemoHelper.AddShape(DemoInfo, shape2, 50, new ALVector2D(0, 400, 300)); }
protected override void Open() { dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(50, 0)); dispose += DemoHelper.BasicDemoSetup(DemoInfo); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); DemoHelper.AddFloor(DemoInfo, new ALVector2D(0, new Vector2D(700, 750))); IShape shape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("block.png"), 3, 7, 4); DemoHelper.AddGrid( DemoInfo, shape, 20, new BoundingRectangle(300, 500, 900, 710), 50, 2); Body ball = DemoHelper.AddCircle(DemoInfo, 80, 20, 4000, new ALVector2D(0, 1028, 272));// //AddShape(new CircleShape(80, 20), 4000, new ALVector2D(0, new Vector2D(1028, 272))); }
protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(300, 0)); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); DemoHelper.AddLine(DemoInfo, new Vector2D(0, 700), new Vector2D(300, 700), 30, Scalar.PositiveInfinity).IgnoresGravity = true; DemoHelper.AddLine(DemoInfo, new Vector2D(300, 700), new Vector2D(400, 650), 30, Scalar.PositiveInfinity).IgnoresGravity = true; DemoHelper.AddLine(DemoInfo, new Vector2D(400, 650), new Vector2D(500, 650), 30, Scalar.PositiveInfinity).IgnoresGravity = true; DemoHelper.AddLine(DemoInfo, new Vector2D(500, 650), new Vector2D(500, 500), 30, Scalar.PositiveInfinity).IgnoresGravity = true; DemoHelper.AddLine(DemoInfo, new Vector2D(500, 500), new Vector2D(900, 550), 30, Scalar.PositiveInfinity).IgnoresGravity = true; DemoHelper.AddLine(DemoInfo, new Vector2D(400, 400), new Vector2D(600, 300), 30, Scalar.PositiveInfinity).IgnoresGravity = true; DemoHelper.AddRagDoll(DemoInfo, new Vector2D(200, 400)); DemoHelper.AddRagDoll(DemoInfo, new Vector2D(300, 300)); DemoHelper.AddRagDoll(DemoInfo, new Vector2D(400, 200)); DemoHelper.AddRagDoll(DemoInfo, new Vector2D(500, 100)); DemoHelper.AddRagDoll(DemoInfo, new Vector2D(600, 0)); DemoHelper.AddRagDoll(DemoInfo, new Vector2D(700, -100)); }
protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(50, 0)); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); IShape shape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("block.png"), 3, 7, 4); DemoHelper.AddGrid( DemoInfo, shape, 20, new BoundingRectangle(400, 200, 500, 510), 50, 2); Scalar boxlength = 50; Scalar spacing = 4; Scalar anchorLenght = 30; Scalar anchorGap = (boxlength / 2) + spacing + (anchorLenght / 2); List <Body> chain = DemoHelper.AddChain(DemoInfo, new Vector2D(200, 500), boxlength, 20, 200, spacing, 600); Vector2D point2 = new Vector2D(chain[chain.Count - 1].State.Position.Linear.X + anchorGap, 500); Body end2 = DemoHelper.AddCircle(DemoInfo, anchorLenght / 2, 14, Scalar.PositiveInfinity, new ALVector2D(0, point2)); end2.IgnoresGravity = true; HingeJoint joint2 = new HingeJoint(chain[chain.Count - 1], end2, point2, new Lifespan()); joint2.DistanceTolerance = 10; Scene.Engine.AddJoint(joint2); Vector2D point1 = new Vector2D(chain[0].State.Position.Linear.X - anchorGap, 500); Body end1 = DemoHelper.AddCircle(DemoInfo, anchorLenght / 2, 14, Scalar.PositiveInfinity, new ALVector2D(0, point1)); end1.IgnoresGravity = true; HingeJoint joint1 = new HingeJoint(chain[0], end1, point1, new Lifespan()); joint1.DistanceTolerance = 10; Scene.Engine.AddJoint(joint1); end2.State.Position.Linear.X -= 10; end1.State.Position.Linear.X += 10; end2.ApplyPosition(); end1.ApplyPosition(); }
protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); dispose += DemoHelper.CreateTank(DemoInfo, new Vector2D(50, 0)); Scene.Engine.AddLogic(new GravityPointField(new Vector2D(500, 400), 1000, new Lifespan())); IShape shape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("block.png"), 3, 7, 4); for (int index = 0; index < 5; index++) { Vector2D pos = new Vector2D(500, 500) + Vector2D.FromLengthAndAngle(500, .6f * index); DemoHelper.AddRagDoll(DemoInfo, pos); } DemoHelper.AddGrid( DemoInfo, shape, 20, new BoundingRectangle(400, 400, 800, 710), 5, 4); }