Prototype of a Flash game like Poux

November 17th update: part 2 released
November 22nd update: part 3 released
November 28th update: Finished project released

Ok, I know, you are asking for full tutorials and not prototypes, but you have to know that a prototype is the first step to a tutorial and some of you realized nice games starting from prototypes or "incomplete" tutorials.

Anyway, I promise I'll continue all "open" tutorials.

Today I am introducing you the prototype of a Flash game like Poux

Poux

Poux is a fast and challenging board game you have to click on contiguous same colored tiles to remove them.

Time is running fast and adds a new line of tiles at the bottom. Bombs can eliminate a whole line of tiles. Use them wisely.

You can play a nice version of Poux at LightForce.

In this prototype I have only an object linked as "tile" that contains all tiles, one per frame.

In the first and only frame of the main stage, the code is:

ACTIONSCRIPT:
  1. // declaration of the array that will contain the game
  2. field = Array();
  3. // number of frames to pass before inserting a new row
  4. interval = 50;
  5. // tiles placed so far
  6. tiles_placed = 0;
  7. // loop that initializes the field
  8. for (x=0; x<10; x++) {
  9.     field[x] = Array();
  10.     for (y=0; y<10; y++) {
  11.         field[x][y] = 0;
  12.     }
  13. }
  14. // function that places a line of tiles in the bottom of the field
  15. function place_line() {
  16.     for (x=0; x<10; x++) {
  17.         tiles_placed++;
  18.         // if the spot is not empty, must shift the colum
  19.         if (field[x][0] != 0) {
  20.             push_blocks(x);
  21.         }
  22.         tile = attachMovie("tile", "tile_"+tiles_placed, tiles_placed, {_x:10+32*x, _y:300});
  23.         num = Math.floor(Math.random()*8)+1;
  24.         tile.gotoAndStop(num);
  25.         field[x][0] = tiles_placed;
  26.     }
  27. }
  28. // function to be executed at every frame
  29. _root.onEnterFrame = function() {
  30.     interval--;
  31.     if (interval == 0) {
  32.         interval = 50;
  33.         place_line();
  34.     }
  35. };
  36. // function that shifts the column of blocks
  37. function push_blocks(col_number) {
  38.     for (i=9; i>=0; i--) {
  39.         if (field[col_number][i] != 0) {
  40.             if (i != 9) {
  41.                 field[col_number][i+1] = field[col_number][i];
  42.                 _root["tile_"+field[col_number][i]]._y -= 32;
  43.             } else {
  44.                 // if I have more than 10 blocks in a column, remove the 10th block
  45.                 // In a normal game, it would be "game over"
  46.                 _root["tile_"+field[col_number][i]].removeMovieClip();
  47.             }
  48.         }
  49.     }
  50. }

... and in only 50 lines (comments and brackets included) we have the field populating with a new row of tiles every 50 frames.

I will complete the game very soon. Or maybe one of you will have a clue and complete the game for me. I will be happy to host his tutorial.

This is the source code... then move to part 2.

Improve the blog rating this post
Tell me what do you think about this post. I'll write better and better entries.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...

» Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.

15 Responses to “Prototype of a Flash game like Poux”

  1. Teal on November 16th, 2007 2:25 am

    Interesting to watch, but it doesn’t do anything yet. Can’t wait for the follow up though!

  2. CGR on November 16th, 2007 3:40 am

    What I can say? Colored:P

  3. Thomas on November 16th, 2007 5:21 am

    I think that that may be useful for preloaders, ya know, to give them something to look at?

    Like a screensaver!

  4. stevie on November 16th, 2007 12:53 pm

    How do you make a reset button?

  5. shiv1411 on November 16th, 2007 1:17 pm

    hi emanuele,
    whats up?
    Great tutorial and I even played poux.
    Your prototype idea is great like you, and I appreciate it.
    Anyways, I completed my first ever complete game in flash actionscript and its a funny 7 level game. I want to submit this game to you before submitting it to mochiads.

    Can you spare little time for my first attempt?

  6. shiv1411 on November 16th, 2007 1:31 pm

    hOw Do I eMaIl EmAnUeLe FeRoNato?

  7. Emanuele Feronato on November 16th, 2007 1:42 pm

    Send me your game at info@emanueleferonato.com

  8. shiv1411 on November 16th, 2007 2:18 pm

    thanks emanuele!
    anyways when i tried to submit my game to mochiads, following all their instructions, they said that they did not got a “ping” from my game and i did not see any development after that.

    Whats the fuss?

  9. Emanuele Feronato on November 16th, 2007 7:02 pm

    Probably Mochi server does not “see” your game.

    Do you see Mochi ads when you run your game?

  10. s0d4player on November 16th, 2007 11:22 pm

    LOL!! I love your new header.

  11. Prototype of a Flash game like Poux - Part 2 : Emanuele Feronato - italian geek and PROgrammer on November 17th, 2007 2:52 am

    [...] this is the quickest prototype update ever. Yesterday I came with the Prototype of a Flash game like Poux, a bit incomplete because you could merely watch tiles [...]

  12. shiv1411 on November 17th, 2007 7:38 am

    I see a Mochi loading bar but not their logos.
    That bar does not even fill even half and the game begins.
    WhAt ShOuLd Be DoNe?

  13. Prototype of a Flash game like Poux - Part 3 : Emanuele Feronato - italian geek and PROgrammer on November 22nd, 2007 1:55 am

    [...] update of the prototype. Remember to read part 1 and [...]

  14. noobflashie on November 24th, 2007 7:33 pm

    Whenever I try to open your source codes, I get an “Unexpected File Format” message. This is probably because I’m using MX 2004, but I need to know something, how large are your tiles(does it matter?) and how many different ones are there(I counted seven, but does this matter)?

  15. noobflashie on November 24th, 2007 7:36 pm

    never mind, i got both questions figured on my own

Leave a Reply