Reputation: 21
I don't understand how to fix this problem, what am I suppose to change 'Game' too?
namespace Game {
public class Help : Microsoft.Xna.Framework.GameComponent
{
public Help(Game game): base(game)
{
// TODO: Construct any child components here
}
public override void Initialize()
{
// TODO: Add your initialization code here
base.Initialize();
}
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here
base.Update(gameTime);
}
}
}
Upvotes: 2
Views: 2385
Reputation: 48537
If you are going to use your namespace of Game
, then for everytime you want to use the Microsoft.Xna.Framework.Game
class, you'll need to specify the full namespace Microsoft.Xna.Framework
.
Upvotes: 2
Reputation: 11
I think your issue is the Game namespace as it is the same as the Game object type and the compiler can't differentiate them. Change the name of the namespace.
Upvotes: 1
Reputation: 1912
Rename your namespace 'Game' to something like MikesGame:
namespace MikesGame {
public class Help : Microsoft.Xna.Framework.GameComponent
{
public Help(Game game): base(game)
{
// TODO: Construct any child components here
}
public override void Initialize()
{
// TODO: Add your initialization code here
base.Initialize();
}
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here
base.Update(gameTime);
}
}
}
Upvotes: 8
Reputation: 32258
Game is your namespace, just as the error suggests.
namespace Game {
Your attempting to pass in an object also called Game
public Help(Game game)
You either need to change your namespace to be something other than your object name, or fully qualify your object 'Game' if you have an object under another namespace called Game. e.g
public Help(AnotherNamespace.Game game)
Upvotes: 4
Reputation: 77536
You named your namespace "Game" which collides with the built in XNA type, Game
. Change Game
to Microsoft.Xna.Framework.Game
or rename your namespace to something else.
Upvotes: 2