Bejeweled AS3 engine with array rotation

I wanted to have a look at a Bejeweled game featuring the 90 degrees array rotation I explained yesterday.

So I took the script made by Brook Jordan in the complete Bejeweled game in less than 2KB – legible version and added some quick and dirty code to make it work:

My code is written mainly at lines 197-218

To save coding time, I only rotate the two-dimensional array, then remove all jewels and recreate them in their new position.

This is the result:

I wonder if it could be interesting to create a real game out of it. Any idea?

No need to download anything, replace the source code of the original prototype with the one on this page.

  • baudaffi

    Try to change the direction of the traspose and try to make the traspose of a minor whit a particolar bonus.

  • baudaffi

    Ehm not traspose (my foult) rotation :P

  • I follow your blog more than 2 years, this blog inspire me for many games. I want to say just “thank you” :)

    Also, this game needs smooth collapse effect.

  • Jae

    you color scheme is still terribly color blind hating.

  • what about a rotate button?

  • Nice tutorial

  • I was thinking about maybe doing a twister version of bejeweled. It would be something close to this, I like the concept of rotating the entire board, how about rotating rotating 4 gems to make a match, kinda what I was thinking. Love your site and love the demos.

  • Pingback: Bejeweled AS3 engine with array rotation – Emanuele Feronato « eaflash()

  • Nice game but it never ends :)

  • saratogacoach

    Brilliant tutorial!

    Is there any way to center the gemCanvas (on a bigger,1024X768 stage) and have the selectorBox still work in the new location?

  • RePlay

    gemCanvas.getChildByName(i+”_”+j).y+=60;

    What exactly does this line 80 do? I assumed that it moves down the gem that is located above the empty space so that the gem can replace the empty space.
    To test it, I comment it out but the game still works well.