Developing Game-Themed Applications with XNA

Day 1 - Section III: The Block Breaker Game
c. The Ball class

back to Day-1 main page


References:

Goals: In this tutorial we want to experience:

Library functions to notice:



Implementation:
  1. Create a new file: Ball.cs. Here is the link to the file. Interesting features of this class includes:
  2. Changes to: Game1.cs


Lesson Learned:

For each object in our application, we should pay attention to two attributes: appearance and behavior. These two attributes maps perfectly to the InitializeWorld() and the UpdateWorld() functions. In general, we should define object to encapsulate our objects. The constructor should define appearance and we should define an Update() function for the class to implement the behavior.


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