Developing Game-Themed Applications with XNA

Day 1 - Section III: The Block Breaker Game
f. Including file texture images

back to Day-1 main page


References:

Goals: In this tutorial we want to experience:

Library function to notice:

Implementation:
  1. Including texture resources: Under the Solution Explorer, open the Content tab,
  2. Background Texture: Game1.cs:
  3. Block Texture:  Block.cs
  4. Paddle without texture: Paddle.cs: Recall that the Paddle class is a subclass from the Block class. The Block constructor assigns the blockTexture by default. In the Paddle constructor, we change the texture:


Lesson Learned:

There are two things we should keep in mind when working with file textures:

  1. Inclusion into the project: we must add each texture image into the project. These images must be added to the Textures folder under Content/Resources.
  2. Using the texture image: Notice we use the texture image without the file name extension.

This document and the related materials are developed with support from Microsoft Research Computer Gaming Initiative under the Computer Gaming Curriculum in Computer Science RFP, Award Number 15871, and 16531.


Kelvin Sung
Computing and Software Systems
University of Washington, Bothell
ksung@u.washington.edu