Build 10 games and learn game development along the way in this fast paced game development course

Get the source code of 12 commercial games, loaded 50+ million times, and learn the secrets of game design

Learn how to make a successful Flash game from a real world example. Fully commented source code

Create realistic Flash physics games from scratch with advanced features, from Angry Birds to Crush the Castle

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.

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 3.50 out of 5)
Loading ... Loading ...
Learn how to make a successful commercial Flash game from a real world example: get the fully commented source code of Globez, a Flash game played millions of times which generated a four figure income. Limited copies available.

Get it now
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 11 comments

  1. baudaffi

    on November 9, 2012 at 7:21 pm

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

  2. baudaffi

    on November 9, 2012 at 7:22 pm

    Ehm not traspose (my foult) rotation :P

  3. junus

    on November 9, 2012 at 7:35 pm

    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.

  4. Jae

    on November 9, 2012 at 7:38 pm

    you color scheme is still terribly color blind hating.

  5. alfonsofonso

    on November 9, 2012 at 9:01 pm

    what about a rotate button?

  6. Anup

    on November 9, 2012 at 9:04 pm

    Nice tutorial

  7. Billy Bateman

    on November 10, 2012 at 6:02 am

    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.

  8. Bejeweled AS3 engine with array rotation – Emanuele Feronato « eaflash

    on November 12, 2012 at 10:39 am

    [...] on http://www.emanueleferonato.com Share this:TwitterFacebookLike this:LikeBe the first to like [...]

  9. gssgames

    on December 25, 2012 at 10:55 am

    Nice game but it never ends :)

  10. saratogacoach

    on January 30, 2013 at 3:30 pm

    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?

  11. RePlay

    on July 12, 2013 at 7:48 am

    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.

Thank you for the download!!

I hope you will find it useful and make something interesting out of it

To keep up to date with the blog, why don't you like my Facebook page and follow me on Twitter?

Want to learn more? Don't miss this:

Learn how to make a successful commercial Flash game from a real world example: get the fully commented source code of Globez, a Flash game played millions of times which generated a four figure income. Limited copies available.

Get it now

×