public override void Initialize() { screenCursorPos = Vector2.Zero; worldCursorPos = Vector2.Zero; world = new World(Vector2.Zero); map = LoadMapFromFile("map1"); mapBodies = new List<Body>(); for (int i = 0; i < map.Count - 1; i++) { Vector2 difference = map[i] - map[(i + 1) % map.Count]; float distance = Vector2.Distance(map[i], map[(i + 1) % map.Count]); Vector2 centre = (map[i] + map[(i + 1) % map.Count]) / 2f; float angle = (float)Math.Atan2(difference.Y, difference.X) + MathHelper.PiOver2; Body temp = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(3f), distance, 1f, centre); temp.CollisionCategories = Category.Cat2; temp.CollidesWith = Category.Cat1; temp.Rotation = angle; temp.BodyType = BodyType.Static; mapBodies.Add(temp); } player1 = new Player(this, ConvertUnits.ToSimUnits(0, 0), world, Color.Yellow); player2 = new Player(this, ConvertUnits.ToSimUnits(500, 500), world, Color.Aquamarine); camera = new Camera(owner.Graphics.GraphicsDevice); camera.TrackBody(player1.Body); }