/// <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); // Initialise physics world // 9.8 gravity on Y, 0 gravity on X world = new World(new Vector2(0, 9.8f)); // Test init random = new Random(); prevKeyboardState = Keyboard.GetState(); objects.Add(new PhysicalObject(world, new Vector2(GraphicsDevice.Viewport.Width / 2.0f - 150, GraphicsDevice.Viewport.Height - 50), BodyType.Static, Content.Load<Texture2D>("Sprites/SquareColliderDebug"), new Vector2(GraphicsDevice.Viewport.Width-300, 100.0f), 1000)); objects.Add(new PhysicalObject(world, new Vector2(15, GraphicsDevice.Viewport.Height / 2), BodyType.Static, Content.Load<Texture2D>("Sprites/SquareColliderDebug"), new Vector2(30.0f, GraphicsDevice.Viewport.Height), 1000)); objects.Add(new PhysicalObject(world, new Vector2(GraphicsDevice.Viewport.Width - 300, GraphicsDevice.Viewport.Height / 2), BodyType.Static, Content.Load<Texture2D>("Sprites/SquareColliderDebug"), new Vector2(30.0f, GraphicsDevice.Viewport.Height), 1000)); player = new Actor(world, new Animation(new List<Vector2>() { new Vector2(1, 8), new Vector2(9, 18), new Vector2(19, 25), new Vector2(26, 32), new Vector2(33, 33) }, 0, new Vector2(6, 8), 9), new Vector2(200, 200), new Vector2(50, 55)); player.Load(Content); }
public void Update(GameTime gameTime, Actor player) { centre = new Vector2(player._Position.X + (player._BodySize.X / 2) - view.Width / 2, player._Position.Y + (player._BodySize.Y / 2) - view.Height / 2); transform = Matrix.CreateScale(new Vector3(1,1,0)) * Matrix.CreateTranslation(new Vector3(-centre.X, -centre.Y, 0)); }