Edit: Sorry for posting in Lua section.
Hello! As the title says I'm struggling around with an array.
Basically I'm trying to make a tetris and I started off by making the board. (A multi dimensional array)
And I was just testing my method that would end the game if any block reached the last part of the array, and I didn't get it working.
I manage to edit the array fine, with the new values etc. But I don't manage to make the changes get outside it´s class. So the method doesn't fulfil it´s function.
Here is the class where I store the array:
[CODE] class Setup
{
public const int BoardWith = 10;
public const int BoardHeight = 10;
public int[,] BoardData = new int[BoardHeight, BoardWith];
public int Empty = 0;
public int Full = 1;
}[/CODE]
Here is the class that should edit the arrays value (in this case all values to 1)
[CODE] class TheEmptyBoard
{
public void CreateBoard(int BoardX, int BoardY)
{
Setup B = new Setup();
for (int i = 0; i < BoardY; i++)
{
for (int j = 0; j < BoardX; j++)
{
B.BoardData[i, j] = B.Full;
}
}
}
}[/CODE]
Here is the Main():
[CODE] class Program
{
static void Main()
{
Tetris.Board.TheEmptyBoard B = new Tetris.Board.TheEmptyBoard();
Setup S = new Setup();
B.CreateBoard(10, 10);
Console.WriteLine("Something is wrong since it the value is {0} and not 1", S.BoardData[1, 1]);
Console.ReadKey();
}
}[/CODE]
Any help with the "B.BoardData[i, j] = B.Full;" and how I could make it change the real array would be very well appreciated!
Thanks on advance!
Snip it. This is lua section, not c++. Take this to the programming section.
[QUOTE=aurum481;36458805]Snip it. This is lua section, not c++. Take this to the programming section.[/QUOTE]
Isn't this C# actually?
You can post in the programming forum. Someone will be able to help you there.
Sorry, you need to Log In to post a reply to this thread.