protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Create and load the level. level = new Level(this.Content); // Load level. level.LoadLevel(); // Create the Shoes. shoes = new Shoes(Content.Load<Texture2D>("Sprites/Shoes32x48"), Character.State.Idle, 0, 32, 48, 0, spriteBatch, graphics.PreferredBackBufferHeight, graphics.PreferredBackBufferWidth, Keys.W, Keys.A, Keys.S, Keys.D, this.Content); // Set the initial position of the player. shoes.Position = level.getPlayerStartingPosition(); // Create the Guy. guy = new Guy(Content.Load<Texture2D>("Sprites/Guy32x48"), spriteBatch, 0, 0, 32, 48, graphics.PreferredBackBufferHeight, graphics.PreferredBackBufferWidth); // Load the debug font. We use this for debugging purposes. debugFont = Content.Load<SpriteFont>("debugFont"); }
/// <summary> /// Update method for the Guy that's called once a frame. /// </summary> /// <param name="gameTime">Snapshot of the game timing state.</param> /// <param name="shoes">A reference to the Shoes.</param> /// <param name="level">A reference to the current Level.</param> public void Update(GameTime gameTime, ref Shoes shoes, ref Level level) { currentLevel = level; handleAnimation(gameTime); handleMovement(gameTime, ref shoes); }