Anonymous
public text v1 · immutable public void checkDrops()
{
boolean changed = false;
for (int i=blocks[0].length-1; i > 0 ; i--) // push them all the way down
{
for (int x=0; x < blocks.length; x++) // X axis
{
for (int y=blocks[0].length-1; y > 0 ; y--) // Y axis
{
Block b1 = blocks[x][y];
Color c1 = b1.getColor();
Block b2 = blocks[x][y-1];
Color c2 = b2.getColor();
if (c1.equals(Color.BLACK))
{
if (!c1.equals(c2))
changed = true;
b1.setColor(c2);
b2.setColor(c1);
}
}
}
}
if (changed)
checkCombos();
}