Time for action – customizing the BackgroundScreen class
To customize the background image for Mars Runner, perform the following steps:
1. Download the
7089_09_GRAPICSPACK.zip
file from the book's website and extract the contents to a temporary location.2. Select the
Textures
,Models
, andHeightMaps
folders from the temporary location and copy them to the Windows clipboard.3. In Visual Studio, right-click on Content (the name of the content project for a GSM project) and select Paste to add the folders and their contents to the project.
4. Expand the
Models
folder in the content project and exclude all of the PNG files, along with theSphere
folder from the project.5. In the
LoadContent()
method of theBackgroundScreen
class (located inside theScreens
folder in the project), change the name of the texture that is loaded from"background"
to @"textures\marsrunner"
. The new line should read:backgroundTexture = content.Load<Texture2D>@("textures\marsrunner");
6. Launch the game and...