Dungeon Raid iPhone game engine made with Flash and AS3 – making items fall

Here we go with a feature which has been requested a lot: taking the Dungeon Raid iPhone game engine made with Flash and AS3 and making items fall once you collect some of them, just like all Bejeweled-like games.

You can find some examples in these posts: Complete Bejeweled game in less than 2KB, Complete Bejeweled prototype made with jQuery and Complete Bejeweled game in less than 2KB – legible version.

The concept is also very similar: once you performed a successful match, scan all items from bottom to top, shifting down floating items and replacing empty spots on the top of the grid with new items.

Moreover, it’s even easier because this kind of game does not feature combos.

Here is the commented source code:

and this is the result:

Draw with the mouse to match items of the same color. This prototype does not include any animation, but it should be easy to add them.

Download the source code.

  • Nice!

    I accidentally dragged off the stage (the index is -1 is out of range 8), so it looks like that is being handled, and still works.

    Nice addition!

  • Jae

    A cool tutorial, but there is a significant flaw in the design.
    It is not only possible, but very likely to start with or quickly get to a board arrangement with no moves. What are some strategies you could use to prevent this?

    Also, your color scheme is not colorblind friendly. It is VERY difficult to tell the green and yellow apart.

  • Pingback: Dungeon Raid iPhone game engine made with Flash and AS3 ... | Video Gamer Weekly()

  • Jae

    never mind on the locked position, I didn’t know you could move across diagonals.

  • I will have a lot of work to do to achieve these effects (beginner) but it already sucked me up.

  • Alex

    Main.as(23): col: 26 Error: Call to a possibly undefined method Tile.
    Main.as(88): col: 35 Error: Call to a possibly undefined method Path.

    ???