hey all, i'm new here. i've been working on an rpg for a while and i've come across a problem. first of all i have a matrix for every screen of the game. for example,
{2, 1, 3}
{2, 5, 4}
{3, 2, 2}
would mean there are 9 squares in the screen, each number represents a different terrain, that I draw a square of on the screen.
Now the first level has 11 screens and I have a function called Newscreen that draws each screen as well as a function that sets the matrix screen[][] to the values needed for that particular screen. My problem is that because I can't change every value of the matrix at once, I can't send the matrix to the function that defines them, and then define them. For example, C++ doesn't allow you to do this:
int array[3];
array = {4, 5, 6};
You must initialize the array when you declare it. My question to all of you, is there a way to, in a sense, re-initialize an array, or change all of the values of it without fifty pages of array[0] = 4; array[1] = 5; ...
in order to make it more clear to you, this is what it looks like.
Code:
void Screen0(...)
{ ...
Newscreen(0);
....
}
void Newscreen(int screennum)
{ Getscreen(screennum);
...
}
Getscreen(int screennum)
{ if (screennum == 0)
int screen0[20][20] = {...};
...
}
I can't access the matrix in other functions without passing it as an argument, and I can't declare it beforehand, because I need to be able to initialize it in the Getscreen function.
Anything you can tell me would be helpful. Thanks.