Time for action – building the Gemstone class

  1. Add a new class file called Gemstone.cs to the Gemstone Hunter project.
  2. Add the following using directives to the Gemstone class:
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Content;
    using Microsoft.Xna.Framework.Graphics;
    using Tile_Engine;
  3. Modify the declaration of the Gemstone class to make the class public, and derive it from the GameObject class:
    public class Gemstone : GameObject
  4. Add a constructor for the Gemstone class:
    #region Constructor public Gemstone(ContentManager Content, int cellX, int cellY) { worldLocation.X = TileMap.TileWidth * cellX; worldLocation.Y = TileMap.TileHeight * cellY; frameWidth = TileMap.TileWidth; frameHeight = TileMap.TileHeight; animations.Add("idle", new ...

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.