iphone - Do tagged images occupy memory/locations? -
i wondering if tagged images can occupy memory/locations (i'm not sure call them call them memory/locations)...
the code below used find matches , removes them view when 3 or more in row/column. thing though seems if statements works once. once have been used stop finding matches.
is there way of "releasing" occupied if statements or there way of doing this?
for( int y=0; y<height-2; y++ ){ for( int x=0; x<width-2; x++ ){ //don't match empty squares if(grid[x][y] == nil){ continue; nslog(@"continue"); } if(x >= 2 && x <= width -2 && y >= 2 && y <= height - 2) { //check right if(grid[x+1][y].tag == grid[x][y].tag && grid[x+2][y].tag == grid[x][y].tag) { nslog(@"to right"); grid[x][y].alpha = 0; grid[x+1][y].alpha = 0; grid[x+2][y].alpha = 0; nslog(@"match right grid[x][y].tag %d",grid[x][y].tag); nslog(@"match right grid[x+1][y].tag %d",grid[x+1][y].tag); nslog(@"match right grid[x+2][y].tag %d",grid[x+2][y].tag); } //check left else if (grid[x-1][y].tag == grid[x][y].tag && grid[x-2][y].tag == grid[x][y].tag){ nslog(@" left"); grid[x][y].alpha = 0; grid[x+1][y].alpha = 0; grid[x+2][y].alpha = 0; nslog(@"match left grid[x][y].tag %d",grid[x][y].tag); nslog(@"match left grid[x-1][y].tag %d",grid[x-1][y].tag); nslog(@"match left grid[x-2][y].tag %d",grid[x-2][y].tag); } //check else if(grid[x][y-1].tag == grid[x][y].tag && grid[x][y-2].tag == grid[x][y].tag){ nslog(@"up"); grid[x][y].alpha = 0; grid[x][y-1].alpha = 0; grid[x][y-2].alpha = 0; nslog(@"match grid[x][y].tag %d",grid[x][y].tag); nslog(@"match grid[x][y-1].tag %d",grid[x][y-1].tag); nslog(@"match grid[x][y-2].tag %d",grid[x][y-2].tag); } //check down else if(grid[x][y+1].tag == grid[x][y].tag && grid[x][y+2].tag == grid[x][y].tag){ nslog(@"down"); grid[x][y].alpha = 0; grid[x][y+1].alpha = 0; grid[x][y+2].alpha = 0; nslog(@"match down grid[x][y].tag %d",grid[x][y].tag); nslog(@"match down grid[x][y+1].tag %d",grid[x][y+1].tag); nslog(@"match down grid[x][y+2].tag %d",grid[x][y+2].tag); } else{ gamepaused = no; } }
}
no, don't take memory. assigned identified uniquely in parent.
Comments
Post a Comment