Adding Content

This file will go over adding content to your game. For help on creating a project please look at Creating a New Project

First of all you are gonna need some content for your game. For this tutorial use the following image of a ball:

Open Content

Do right-click > Save Image As and save it somewhere with the name "ball.png".

Now open up your game project and look at the left. You should see a solution explorer window. Expand the Content folder and open up Content.mgcb file by double clicking on it.

Open Content

You should now see a MonoGame Pipeline Tool window open up. In case it didn't get opened, you can right-click on Content.mgcb, select open with and then select MonoGame Pipeline.

MonoGame Pipeline Tool

Your game content is managed from this external tool. You can add content to your game in one of the following ways:

In our case let's use the Add Existing Item toolbar button.

Add Content

You should now be prompted to select a file. Select the "ball.png" that you have downloaded a moment ago. After that you will be asked on what action you want to do for adding the file. Just leave the it to default and click OK.

Copy Content

Now simply click Save toolbar button and close the tool.

Save Content

Now that we have added the content, it's time to load it. First declare a new variable so we can load the ball image into memory.

public class Game1 : Game
Texture2D textureBall;

GraphicsDeviceManager graphics;

Next find the Load Content method and use it to initialize the ball private variable:

protected override void LoadContent()
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);

// TODO: use this.Content to load your game content here
textureBall = Content.Load<Texture2D>("ball");

And finally, find the Draw method, and let's draw the ball onto the screen:

protected override void Draw(GameTime gameTime)

// TODO: Add your drawing code here
spriteBatch.Draw(textureBall, new Vector2(0, 0), Color.White);


Now run the game and you should get the following:


For the next part, look at Adding Basic Code page.