This page is optimized for mobile devices, if you would prefer the desktop version just
click here
Learn to design, create, and use a simple Sprite class. Also learn to use a generic List object.
Revised: Mon May 09 13:00:37 CDT 2016
This page is part of a Book titled XNA Game Studio .
Table of Contents
- Table of Contents
- Preface
- General background information
- Preview
-
Discussion and sample code
- The Sprite class
-
The Game1 class
- The generic List class
- The modified Game1 constructor
- The overridden LoadContent method
- The overridden Update method
- The overridden Game1.Draw method
- Run the program
- Run my program
- Summary
- Miscellaneous
- Complete program listing
Preface
This module is one in a collection of modules designed primarily for teaching GAME 1343 Game and Simulation Programming I at Austin Community College in Austin, TX. These modules are intended tosupplement and not to replace the textbook.
An earlier module titled Getting Started provided information on how to get started programming with Microsoft's XNA Game Studio.
Viewing tip
I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the Figuresand Listings while you are reading about them.
Figures
Listings
- Listing 1 . Beginning of the Sprite class.
- Listing 2 . Two overloaded constructors.
- Listing 3 . The SetImage method.
- Listing 4 . The Draw method of the Sprite class.
- Listing 5 . Beginning of the class named Game1.
- Listing 6 . The modified constructor for the Game1 class.
- Listing 7 . The overridden LoadContent method.
- Listing 8 . Beginning of the overridden Update method.
- Listing 9 . Instantiate new Sprite objects.
- Listing 10 . Make all the existing sprites move.
- Listing 11 . Load a green ball image in the topmost Sprite object.
- Listing 12 . Maintain the frame counter.
- Listing 13 . The overridden Game1.Draw method.
- Listing 14 . Contents of the file named Sprite.cs
- Listing 15 . Contents of the file named Game1.cs.
Read also:
OpenStax, Xna game studio. OpenStax CNX. Feb 28, 2014 Download for free at https://legacy.cnx.org/content/col11634/1.6
Google Play and the Google Play logo are trademarks of Google Inc.