Time for action – building the GameObject class – Part 1

  1. Add a new class called GameObject.cs to the Gemstone Hunter project.
  2. Add the following using directives to the GameObject class:
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
    using Tile_Engine;
  3. Modify the declaration of the GameObject class to make the class public:
    public class GameObject
  4. Add declarations to the GameObject class:
    #region Declarations protected Vector2 worldLocation; protected Vector2 velocity; protected int frameWidth; protected int frameHeight; protected bool enabled; protected bool flipped = false; protected bool onGround; protected Rectangle collisionRectangle; protected int collideWidth; protected int collideHeight; protected bool codeBasedBlocks ...

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.