Original Post
Hi,
I''m writing a breakout clone and I have some problems with a switch statement. This is the function that causes the problems:
void TBreakout::UpdateGrid(int R, int C)
{
switch (Grid[R][C])
{
case 1:
Grid[R][C] = 0;
break;
case 2:
Grid[R][C] = 0;
break;
case 3:
Grid[R][C] = 0;
break;
case 4:
Grid[R][C] = 5;
break;
case 5:
Grid[R][C] = 6;
break;
case 6:
Grid[R][C] = 7;
break;
case 7:
Grid[R][C] = 8;
break;
case 8:
Grid[R][C] = 0;
break;
case 9:
Grid[R][C] = 0;
break;
}
}
The grid cells contain the type of block. 0 is empty, 1 to 3 are colored blocks, 4 to 8 are blocks with cracks in them that become larger and 9 is an exploding block. The effect should be that if you hit a block with cracks, they become bigger until the block is destroyed (wich should take 5 hits). The problem is that the blocks are always destroyed immediately. So if I hit a block with index 4, the index should become 5 and not 0. It seems like the rest of the switch statement is executed regardless of the break statement. Any suggestions on how to solve this?
---------
http://users.pandora.be/koen.van.baelen
---------