Game Background

I am first year games design student and for my end of year project me and my classmates have to create a side-scrolling 2D Game, we are very inexperienced with this software. One thing we are having difficulties is to add a background for our first level, the level 1 was created on Photoshop and we was wondering how do you implement it into the game.

The steps to take are the following:

  1. Add the texture to your content using the pipeline tool
  2. Load the texture in your game using ContentManager.Load<Texture2D>("texture"); (no extension!)
  3. Create a SpriteBatch object. This should already be done in every template MonoGame installs. Using SpriteBatch is the easiest way to draw 2D textures in MonoGame.
  4. In your Draw method, call SpriteBatch.Begin to begin drawing sprites, draw your sprite using one of the SpriteBatch.Draw overloads and finish drawing by calling SpriteBatch.End.

If run into any trouble or something is unclear, feel free to ask a more specific question :slight_smile:

1 Like

Thank you for the support! I will get back to you if any problems! :smile:

1 Like

i need your help with monogame please as i have a big problem

Maybe you must describe your problem or create a new topic

The problem is that my version of visual studio does not allow me to ā€˜resolveā€™ certain pieces of codeā€¦ example would be ā€˜Texture2Dā€™ has a red line underneath and the program does not allow me to fix this which does not allow me to add a background

i did create a new Topic so check it out pls xox

If you are getting a ā€œred lineā€ underlying an object this most often means that you are missing the required library references that the object uses.

For Monogame objects you commonly require the following ā€œusingā€ statementsā€¦

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;

To be able to use these statements your project must reference the ā€œMonogame.Frameworkā€ dllā€¦

1 Like