Developing Game-Themed Applications with XNA

Day 1 - Section III: The Block Breaker Game
d. The Block and Paddle Class

back to Day-1 main page


References:

Goals: In this tutorial we want to experience:

Library function to notice:



Implementation:
  1. Create a new file: Block.cs. This is a simple rectangular block that knows how to bounce a Ball. Here is the link to the file. Interesting features of this class includes:
  2. Create a new file: Paddle.cs. This will be the paddle at the bottom of the application window. Notice that the paddle is a special type of rectangular Block, so we subclass from the Block class. Here is the link to the source file. Interesting features of this class include:
  3. Changes to: Game1.cs


Lesson Learned:

We worked with two objects in the application: the ball and the paddle. During the Game1::UpdateWorld() function we:

In general, when our application has multiple objects, we can update each object independently, and then be concerned with the interaction between the objects.


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