/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); world = new World(new Vector2(0, 9.8f)); random = new Random(); floor = new DrawablePhysicsObject(world, Content.Load<Texture2D>("Floor"), new Vector2(GraphicsDevice.Viewport.Width, 100.0f), 1000); floor.Position = new Vector2(GraphicsDevice.Viewport.Width / 2.0f, GraphicsDevice.Viewport.Height - 50); floor.body.BodyType = BodyType.Static; crateList = new List<DrawablePhysicsObject>(); prevKeyboardState = new KeyboardState(); // TODO: use this.Content to load your game content here }
private void SpawnCrate() { DrawablePhysicsObject crate; crate = new DrawablePhysicsObject(world, Content.Load<Texture2D>("wooden"), new Vector2(50.0f, 50.0f), 0.1f); crate.Position = new Vector2(random.Next(50, GraphicsDevice.Viewport.Width - 50), 1); crateList.Add(crate); }