I'm really new to C# but I'm trying to make a simple game. In order to make the movement and positioning of instances easy, I'm using an array. The problem is that I can't seem to get it to work.
I get the error message:
'GAArr' doesn't exist in the current context
for details see the Draw method.
//Every part of the world: terrain, enemies, itmes and alike
static void World()
{
int GAWidth = 78;
int GAHeight = 25;
string[,] GAArr = new string[GAWidth, GAHeight]; //said array
...
}
//Wall class
class Wall {
...
public Wall(int x, int y, int mh){
...
}
void Draw() {
GAArr[x, y] = "#"; //it says the name 'GAArr' doesn't exist in the current context
}
}
(I'm sorry for copying all the code, but it might make it clearer what I'm trying to do) I've tried some of the solutions like creating a static global class, but that didn't seem to work. The other thing I saw was an Auction class, but (from what I understand) that would take a lot of time and make it harder to access and manipulate the position of instances. Please help.
worldbut inside the class.