Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3230564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:56:30+00:00 2026-05-17T16:56:30+00:00

I am still kinda new to developing games in XNA and using classes with

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:56:31+00:00Added an answer on May 17, 2026 at 4:56 pm

    You probably want to have a hierarchy of GameObjects, so you players and your enemies etc would have a GameObject as the root. Only the main Game class would actually be deriving from Microsoft.Xna.Framework.Game.

    If you follow the Xna model of GameComponents, you would have the base GameObject deriving from DrawableGameComponent. Of course the logic of the players and enemies could be extracted out into Controller classes which you can then inject into the GameObject to give each object it’s in game behaviors.

    I would suggest you start with some of the game samples at XNA Creators Club, it’s currently down but I am sure it will be up soon. Use these samples to help you formulate your game structure.

    You might also want to check out Riemer’s XNA Tutorials. This is a quite a nice introduction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still kinda new to using Regular Expressions, so here's my plight. I have
Goodmorning everybody! I'm not completely new to PHP as in self but still kinda
So, I am kinda new to ASP.net development still, and I already don't like
I still very new using Subversion. Is it possible to have a working copy
I am developing a simple platform game in Java using BlueJ. Over the next
I'm new to Mongo DB and Mongoid (and still kinda new to Ruby on
I'm using the Tornado framework (Python) on GAE. I'm still kind of new to
I'm kinda new to Python, so i'm still lost in the whole namespace thing.
Kinda new to Silverlight and have some experience with WPF but I'm doing a
Still 'diving in' to Python, and want to make sure I'm not overlooking something.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.