A new Flash game prototype

I played some times ago a game similar to the one I am making the prototype... I think it was a PopCap game, or a game by another casual game developer... anyway it's a game involving a balance and some spheres.

Just a quick, raw actionscript

ACTIONSCRIPT:
  1. field = new Array();
  2. for (x=0; x<10; x++) {
  3.     field[x] = new Array();
  4.     for (y=0; y<6; y++) {
  5.         field[x][y] = 0;
  6.     }
  7. }
  8. attach_sphere = true;
  9. _root.attachMovie("bar", "bar", _root.getNextHighestDepth(), {_x:250, _y:400});
  10. _root.attachMovie("triangle", "triangle", _root.getNextHighestDepth(), {_x:250, _y:400});
  11. _root.onEnterFrame = function() {
  12.     if (attach_sphere) {
  13.         attach_sphere = false;
  14.         sphere = bar.attachMovie("ball", "ball"+bar.getNextHighestDepth(), bar.getNextHighestDepth(), {_x:20,_y:-300});
  15.         sphere.moving = true;
  16.         sphere.onEnterFrame = function() {
  17.             if (this.moving) {
  18.                 pos_x = Math.floor(bar._xmouse/40)+5;
  19.                 if (pos_x<0) {
  20.                     pos_x = 0;
  21.                 }
  22.                 if (pos_x>9) {
  23.                     pos_x = 9;
  24.                 }
  25.                 this._x = pos_x*40-180;
  26.             }
  27.             if (this.falling) {
  28.                 this._y += 20;
  29.                 pos_y = Math.floor((this._y+20)/40);
  30.                 if ((pos_y == 0)or(field[pos_x][pos_y*(-1)-1]==1)) {
  31.                     this.falling = false;
  32.                     field[pos_x][pos_y*(-1)] = 1;
  33.                     attach_sphere = true;
  34.                 }
  35.             }
  36.         };
  37.     }
  38. };
  39. bar.onEnterFrame = function() {
  40.     dir = 0;
  41.     for (x=0; x<10; x++) {
  42.         for (y=0; y<6; y++) {
  43.             if (field[x][y]>0) {
  44.                 if (x<5) {
  45.                     dir -= (5-x);
  46.                 } else {
  47.                     dir += (x-4);
  48.                 }
  49.             }
  50.         }
  51.     }
  52.     dir *= 0.01;
  53.     this._rotation += dir;
  54. };
  55. _root.onMouseDown = function() {
  56.     if (sphere.moving) {
  57.         sphere.moving = false;
  58.         sphere.falling = true;
  59.     }
  60. };

and the result

Can you make a good game out of this? Download the source code

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 (No Ratings Yet)
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.

6 Responses to “A new Flash game prototype”

  1. Ed on February 4th, 2008 9:07 pm

    Interesting, I’m glad most of your tuts now involve mathematics, which I lack in my code. :)

  2. David on February 7th, 2008 9:05 pm

    i like to program small programs, or use actionscript, bu i’ve never seen so many for atatements in a single piece of code!

    could you please explain the code for us

    good tutorials anyway

    keep it up

  3. Experiment: monetizing a Flash game - Part 8 : Emanuele Feronato - italian geek and PROgrammer on March 4th, 2008 7:13 pm

    [...] almost an one-week game (it took me 18 hours to make it) based on A new Flash game prototype post. You should always check for new prototypes because new prototype = new game [...]

  4. A new player control concept : Emanuele Feronato - italian geek and PROgrammer on March 5th, 2008 8:38 pm

    [...] just a prototype, but remember that BallBalance was started from this prototype and ended with this sponsorship… PLAIN TEXT [...]

  5. Thomas on March 6th, 2008 6:49 am

    very good!

  6. Prototype of a Flash game like GearTaker : Emanuele Feronato - italian geek and PROgrammer on May 6th, 2008 8:31 pm

    [...] are the most interesting ways to make a game, remember what I was able to make from this to [...]

Leave a Reply