Chapter 9. Gemstone Hunter Standing on Your Own Two Pixels

With our level editor completed, we can now move on to the building of the Gemstone Hunter game itself. As with the other games in this book, we will build on what we have learned in previous projects and introduce some new concepts.

In this chapter, we will cover the following topics:

  • A new approach to animating game objects using named animation strips
  • A more object-oriented approach to game objects
  • Platform game physics, allowing the player to run, jump, and squash enemies
  • Processing map codes when a map is loaded to spawn objects in the game world
  • Using map codes at runtime to generate in-game effects

Animation strips

In all of the other game projects in this book, our graphical resources have been confined to a single sprite sheet, onto which we have consolidated all of the images needed for our gameplay elements.

This works well for many small games, but it is certainly not the only way to organize your content. Since we are borrowing content from the XNA Platform Starter Kit, we will use it in the format it has been provided to us instead of creating new sprite sheets.

For each type of entity we will display in Gemstone Hunter, we have one or more PNG files containing multiple image frames for a single animation. For example, the Run.png file for the main character from the Platform Starter Kit looks like this:

Animation strips

Each frame is the same size (48 by 48 pixels in this case) and the size of the image file itself determines the number of frames contained in the animation. The run animation is 480 pixels wide, at 48 pixels per frame, so there are 10 frames in the animation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.214.32