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 6932903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:45:51+00:00 2026-05-27T11:45:51+00:00

I’ve been working on a XNA project for a class I’m taking. I had

  • 0

I’ve been working on a XNA project for a class I’m taking. I had an issue with a class that I was making for the “Bad guys” which are snowmen (the class is called Snowman.cs). I cannot get the program to compile and it’s driving me crazy. Someone helped me out with what I think is some solid code for the Snowman.cs class:

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using CameraViewer;

namespace MGH10_Skybox
{
    public class Snowman : DrawableGameObject 
    {
        private Camera cam = new Camera();

        Model snowMan;
        Matrix[] snowManMatrix;

        protected override void LoadContent()
        {
            //snowMan = Content.Load<Model>( "Models\\snowman" );
            snowManMatrix = new Matrix[snowMan.Bones.Count];
            snowMan.CopyAbsoluteBoneTransformsTo(snowManMatrix);
        }

        public void DrawSnowMan(Model model, GameTime gameTime)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                Matrix world, scale, translation;

                scale = Matrix.CreateScale(0.02f, 0.02f, 0.02f);
                translation = Matrix.CreateScale(0.0f, 0.7f, -4.0f);

                world = scale * translation;

                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = snowManMatrix[mesh.ParentBone.Index] * world;

                    effect.View = cam.viewMatrix;
                    effect.Projection = cam.projectionMatrix;
                    effect.EnableDefaultLighting();
                }

                mesh.Draw();
            }
        }

        protected override void Draw(GameTime gameTime)
        {
            DrawSnowMan(snowMan, gameTime);
        }

    }
}

My issue is that I keep getting a compiler error that says “The type or namespace name ‘DrawableGameObject’ could not be found (are you missing a using directive or assembly reference?)”.

I have tried doing all kinds of research on google and I get almost no results for DrawableGameObject, but anything that does talk about it (or at least says it in the page preview) usually ends up using DrawableGameComponent instead.

I’ve tried using DrawableGameComponent, but then I get even more compiler errors which lead me to believe that it truly is not what I’m looking for. Specifically, the error states that “DrawableGameComponent does not contain a constructor that takes ‘0’ arguments” (which goes against how my class and its calls were constructed).

The one gleam of hope that I had was that ‘DrawableGameObject’ is supposedly a .net 4.0 class, and I had been using XNA 3.1 w/ Visual C# 2008 (which does not support 4.0 apparently). So I downloaded XNA 4.0 and Visual C# Express 2010 with high hopes that crashed and burned when I went to change the target Framework only to find the option completely grayed out (even when starting a completely new project).

All help is GREATLY appreciated.

  • 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-27T11:45:52+00:00Added an answer on May 27, 2026 at 11:45 am

    It seems as though you will actually want “DrawableGameComponent” instead, as I couldn’t find anything about a “DrawableGameObject” class. The error you’re getting when trying to inherit from DrawableGameComponent can be fixed by calling the base constructor with the appropriate parameter during your classes constructor, as shown below:

    public Snowman(Game game) : base(game)
    {
       //Whatever goes here!
    }
    

    “game” in the base constructor is supposed to be the Game object that the DrawableGameComponent is attached to.

    Edit:

    Based on your latest comment, I’d recommend adding this constructor to your class (that is, replace what I previously suggested with this constructor):

    public Snowman(Game game, Model snowman) : base(game)
    {
        this.snowman = snowman;
    }
    

    And in your Game1.cs, in your LoadContent function or wherever you’re currently calling “snowMan = Content.Load ( “Models\snowman”);”, try this instead:

    snowMan = new Snowman(this, Content.Load<Model>("Models\\snowman");
    

    This will create a new Snowman instance with the “Model snowman” field initialized.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am doing a simple coin flipping experiment for class that involves flipping a
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.