public override void Initialize() { ClearCanvas(); physicsSimulator = new PhysicsSimulator(new Vector2(0, 100)); physicsSimulator.BiasFactor = .4f; int borderWidth = (int)(ScreenManager.ScreenHeight * .05f); _border = new Border(ScreenManager.ScreenWidth + borderWidth * 2, ScreenManager.ScreenHeight + borderWidth * 2, borderWidth, ScreenManager.ScreenCenter); _border.Load(this, physicsSimulator); _rectangleBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 32, 32, 1f); _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rectangleBody, 32, 32); _rectangleGeom.FrictionCoefficient = .4f; _rectangleGeom.RestitutionCoefficient = 0f; //create the pyramid near the bottom of the screen. _pyramid = new Pyramid(_rectangleBody, _rectangleGeom, 32f / 3f, 32f / 3f, 32, 32, _pyramidBaseBodyCount, new Vector2(ScreenManager.ScreenCenter.X - _pyramidBaseBodyCount * .5f * (32 + 32 / 3), ScreenManager.ScreenHeight - 125)); _pyramid.Load(this, physicsSimulator); _floor = new Floor(ScreenManager.ScreenWidth, 100, new Vector2(ScreenManager.ScreenCenter.X, ScreenManager.ScreenHeight - 50)); _floor.Load(this, physicsSimulator); _agent = new Agent(ScreenManager.ScreenCenter - new Vector2(320, 300)); _agent.Load(this, physicsSimulator); controlledBody = _agent.Body; base.Initialize(); }
public override void Initialize() { ClearCanvas(); physicsSimulator = new PhysicsSimulator(new Vector2(0, 100)); physicsSimulator.BiasFactor = .4f; int borderWidth = (int) (ScreenManager.ScreenHeight*.05f); _border = new Border(ScreenManager.ScreenWidth + borderWidth*2, ScreenManager.ScreenHeight + borderWidth*2, borderWidth, ScreenManager.ScreenCenter); _border.Load(this, physicsSimulator); _rectangleBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 32, 32, 1f); _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rectangleBody, 32, 32); _rectangleGeom.FrictionCoefficient = .4f; _rectangleGeom.RestitutionCoefficient = 0f; //create the pyramid near the bottom of the screen. _pyramid = new Pyramid(_rectangleBody, _rectangleGeom, 32f/3f, 32f/3f, 32, 32, _pyramidBaseBodyCount, new Vector2(ScreenManager.ScreenCenter.X - _pyramidBaseBodyCount*.5f*(32 + 32/3), ScreenManager.ScreenHeight - 125)); _pyramid.Load(this, physicsSimulator); _floor = new Floor(ScreenManager.ScreenWidth, 100, new Vector2(ScreenManager.ScreenCenter.X, ScreenManager.ScreenHeight - 50)); _floor.Load(this, physicsSimulator); _agent = new Agent(ScreenManager.ScreenCenter - new Vector2(320, 300)); _agent.Load(this, physicsSimulator); controlledBody = _agent.Body; base.Initialize(); }