我开始为Window 8开发这个游戏,但我已经为Windows 10编写了错误代码(我不知道这些信息是否有用所以我把它放了)。当我调试时,我看到“ContentLoadException”窗口。 这是对象初始化代码:
//initializes the platform (this object's content is loading fine)
platform.Initialize(Content.Load<Texture2D>("Graphics\\platformTexture"), new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X + GraphicsDevice.Viewport.TitleSafeArea.Width / 2, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height));
//Second initializtion is to use the texture's Height and Width to set position
platform.Initialize(platform.texture, new Vector2(platform.Position.X, platform.Position.Y - platform.texture.Height - 60));
//initializes the ball (this object's content is loading fine)
ball.Initialize(Content.Load<Texture2D>("Graphics\\classicBall"), new Vector2(platform.Position.X, platform.Position.Y), GraphicsDevice, -1);
//Second initializtion is to use the texture's Height and Width to set position
ball.Initialize(ball.texture, new Vector2(ball.Position.X, platform.Position.Y - (float)ball.bounds), GraphicsDevice, -1);
//initializes the brick (this object's content is getting error)
testBrick.Initialize(Content.Load<Texture2D>("Graphics\\classicYellowBrick"), GraphicsDevice.Viewport.TitleSafeArea.Center.ToVector2(), ball);
这是我的Content.mgcb代码
#begin Graphics/platformTexture.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/platformTexture.png
#begin Graphics/classicBall.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/classicBall.png
#begin Graphics/classicYellowBrick.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/classicYellowBrick.png
我已经检查过它是否是位置字符串的写入错误,以及是否在内容文件中引用了它。我已经搜索了fóruns的答案。但我找不到,所以我需要帮助。
感谢您的关注。我希望这足以让你给我一个答案。