2021年5月5日星期三

I'm trying to create a maze game on c# and it is giving me a null reference exception error

I am trying to create a maze game, I'm using arrays to house my maze and while it was working fine a couple of test runs ago, VS is now giving me a null reference exception. I don't know how my array is null, and I could use all the help I can get.

 public void DisplayMaze()          {              string[] map = GetMaze();              for (int x = 0; x < map.Length; x++)              {                  Console.WriteLine(map[x]);                  if (map[x] == map[playerx] && map[x] == map[playery])                  {                      Console.WriteLine("O");                  }                  }                
https://stackoverflow.com/questions/67410540/im-trying-to-create-a-maze-game-on-c-sharp-and-it-is-giving-me-a-null-reference May 06, 2021 at 08:51AM

没有评论:

发表评论