Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jaybee2002

macrumors newbie
Original poster
May 25, 2011
4
0
ok here is m¥ problem,
i have a game which is using a 2d array to load up what the user has done previously (saving state) for each level, to do this i am using a 2d array.
at the moment i have 5 levels and 36 values so save for each level so im using-
gameState[5][36];

and when on the level im loading using,

Code:
for (i=1; i<=36; i++)
{
squarepic[i] = gameState[level][i];
}

and the oposite way round to save the game stat for the level.

my problem arrises when i try and change between levels and the array seems to treat each level like they are the same so whatever has happened in level 1 moves over to level 2 and level 3 as if they were all the same level.

anyone any idea why this could be happening.

thanks jon
 
Last edited by a moderator:
Sounds like a simple logic error, where maybe you level variable isn't getting set correctly, so you end up accessing the same level rather than different ones? (P.S. 2D arrays are actually flat arrays... in memory at least. When I read the title I just had to mention it.)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.