各位大神。。。突然出现了未将对象引用到实例这个错误
public static void Main()
{
SpaceGame game = new SpaceGame();
game.Run();
}
}
run的方法为:
public void Run()
{
_gameWindow = new Window("BlastOff", 600, 600);
while (!_gameWindow.CloseRequested)
{
SplashKit.ProcessEvents();
if (SplashKit.KeyDown(KeyCode.UpKey))
{
_player.Move(4, 0);
}
if (SplashKit.KeyDown(KeyCode.DownKey))
{
_player.Move(-4, 0);
}
if (SplashKit.KeyDown(KeyCode.LeftKey))
{
_player.Rotate(-4);
}
if (SplashKit.KeyDown(KeyCode.RightKey))
{
_player.Rotate(4);
}
if (SplashKit.KeyTyped(KeyCode.SpaceKey))
{
_player.Shoot();
}
_player.TODORENAME();
Draw();
}
_gameWindow.Close();
_gameWindow = null;
}
错误行数是game.Run这一行,这个就是game 未null吗?该如何修改呢?