I am still kinda new to developing games in XNA and using classes with C#, but I want to start a semi-decent game project where I can learn without throwaway projects.
I want to devide my game up into classes. For example a main game class, a player class (i want two players, and they battle against each other), a level class (for drawing the world) and maybe later on things like a power up class and a networking class so I can make everything multiplayer.
But I don't know the best way to start using classes like this in an XNA game. Do I make a class like this:
namespace MyGame
{
class Player : MyGame
{
// whatever
}
}
or like this:
namespace MyGame
{
class Player : Microsoft.Xna.Framework.Game
{
// whatever
}
}
I want each class to have something along the lines of Initialize()
, Update()
and Draw()
methods, and I will use the spriteBatch and GraphicsDeviceManager from my main game class passed to these classes... but I also don't know the best way to pass them in, or even if I should be passing them in over making new ones in the classes themselves.
Any help is greatly appreciated. Thanks.