'namespace' is used like a 'type'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FrEaK411
    New Member
    • Nov 2009
    • 5

    #1

    'namespace' is used like a 'type'

    Ok well Im new to the programming world and Im trying to make and Invaders type game for a class and needing some help on an error.

    public class MenuBaseGameSta te : GameState
    {
    //a SpriteBatch and font to render the menu
    SpriteBatch spriteBatch;
    SpriteFont font;

    //the actual menu object
    protected Menu Menu = new Menu();

    The bolded part is the problem.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Its actually the word AFTER the bolded one I would say. You are naming the object the same as the type.
    For simplicity's sake, try calling it "MyMenu":
    protected Menu MyMenu = new Menu();

    Comment

    • FrEaK411
      New Member
      • Nov 2009
      • 5

      #3
      Ok that fixed that error but for some reason now the GameStateManage r is not working. This time the error is:

      The type or namespace 'GameStateManag er' could not be found (are you using a directive or an assembly reference?)

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Are you using the XNA menu sample?

        Comment

        • FrEaK411
          New Member
          • Nov 2009
          • 5

          #5
          Pretty much yeah with a few extra options for sound in there

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Do you have the XNA libraries installed and the references added to your project?

            Comment

            • RedSon
              Recognized Expert Expert
              • Jan 2007
              • 4980

              #7
              Are you using the provided project files for that sample project that you downloaded from the XNA website?

              I have a project hosted on google code that expands on that sample for Zune devices.

              Comment

              • FrEaK411
                New Member
                • Nov 2009
                • 5

                #8
                Would it help if I upoaded my code? If so where do youwant it uploaded to?


                Well I fixed most of my issues, now imback at the namespace error with the same line of coded. I changed to the one stated above but it still gives me the error.

                Comment

                Working...