Breakout Setup

Setting Up the Project

The Goals

In this tutorial, we're going to do a few things to get us off on the right foot. None of these things are probably truly required, but they give us a starting point that will feel user-friendly. There are five small things that we'll do here:

  • Change the default background to be black.
  • Make the window resizable.
  • Create some game settings for the game's width and height that we can refer to from elsewhere in the game.
  • Change the name of Game1.cs to something else.
  • Add in a button that lets you toggle in and out of full screen mode.

Remember that there are three ways you can approach this tutorial set:

1. Read the Goals section at the top and implement it yourself, returning to the tutorial if you run into trouble,
2. Read the Goals and the Strategy sections through the tutorial so that you know what approach you could take and implement it yourself, or
3. Use the code here directly in your game, unmodified. (If you follow this approach, I'd still recommend typing it all in. You'll learn more by typing than you will by copying and pasting.)

The choice is yours, and it should be dependent on how adventurous you feel, how much time you have, and your current skill level.

Creating a New Project

The first step is to create a project for ourselves to work in, inside Visual Studio. If you're reading this tutorial, you've probably done this before. If you haven't, go take a look over at the tutorial on creating your first MonoGame project.

With a new project created, you should be able to run the default/template project by pressing F5 and seeing the window come up with the default cornflower blue background, as shown below.

Making the Background Black

We'll start ourselves off easy: making the background black by default.