Make a game like Lumines with Flash – part 3

Now it’s time to make bricks disappear if they group in a 2×2 square.

Read part 1 and 2 if you did not already.

It’s not difficult to check if bricks form a 2×2 square… and it’s not difficult to remove them from the stage.

The tricky part is making bricks fill the empty spaces left by disappeared bricks and managing combos (fallen bricks can make another 2×2 square, generating more falling bricks, and so on).

I preferred not to have an onEnterFrame on every brick to check if it’s over an empty space and eventually move it, so I created another array called bricks_in_field saving the depth of the brick in that position, so when I remove some bricks I just have to put in the moveable_bricks the depth found in the bricks_in_field array and the “engine” does the rest.

Here it is the actionscript:

And this is the result:

Now wait for the next step to handle timing events.

Download the source.

  • cool ;)

  • Martin

    Fantastic tutorial, are there still plans to release a fourth part? Please do!

  • Nitis


    I am waiting for next steps, i hope you release it soon.