Time for action – building the GameObject class – Part 1
Add a new class called
GameObject.cs
to the Gemstone Hunter project.Add the following
using
directives to the GameObject class:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Tile_Engine;
Modify the declaration of the GameObject class to make the class public:
public class GameObject
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 = true; protected float drawDepth = 0.85f; protected Dictionary<string, AnimationStrip> animations = new Dictionary<string, AnimationStrip>(); protected string currentAnimation; #endregion
Add properties to the GameObject class:
#region...