diff --git a/source/main.cpp b/source/main.cpp index 10355d1485d208d1b10629c7b70d93aaa69c1797..6bed25454d1146df68dc69d7595dc34f61edf42f 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -287,7 +287,7 @@ bool can_shape_move( } // if Y is negative, we don't need to check this row if (destination.y < 0) { - break; // no point checking this row, out of screen + continue; // no point checking this pixel, out of screen } // check if the translated position of this pixel is not free if (stacked.getPixelValue(destination.x, destination.y) != 0) { @@ -389,12 +389,13 @@ void start_new_game() { Point origin(1, -3); // this is the down unit-vector Vector down(0, 1); - // draw the scene - UBIT.display.print(stacked_shapes); - // draw Block with transparency enabled on clear image pixels - UBIT.display.print(block.image(), origin.x, origin.y, 1); - // while Block can go down + // if Block can go down if (can_shape_move(block, origin, stacked_shapes, down)) { + /* + * this is the Block scrolling down loop + * its exit condition is not checked on every iteration but at a + * fixed time interval (every time the Block is meant to go down) + */ while (true) { // allow player to shift the Block left or right /* @@ -426,6 +427,7 @@ void start_new_game() { if (can_shape_move(block, origin, stacked_shapes, down)) { origin = origin + down; } else { + // if we can't shift it down, then it's time to stop break; } // update the "stopwatch"