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:
-
field = new Array();
-
for (x=0; x<10; x++) {
-
field[x] = new Array();
-
for (y=0; y<6; y++) {
-
field[x][y] = 0;
-
}
-
}
-
attach_sphere = true;
-
_root.attachMovie("bar", "bar", _root.getNextHighestDepth(), {_x:250, _y:400});
-
_root.attachMovie("triangle", "triangle", _root.getNextHighestDepth(), {_x:250, _y:400});
-
_root.onEnterFrame = function() {
-
if (attach_sphere) {
-
attach_sphere = false;
-
sphere = bar.attachMovie("ball", "ball"+bar.getNextHighestDepth(), bar.getNextHighestDepth(), {_x:20,_y:-300});
-
sphere.moving = true;
-
sphere.onEnterFrame = function() {
-
if (this.moving) {
-
pos_x = Math.floor(bar._xmouse/40)+5;
-
if (pos_x<0) {
-
pos_x = 0;
-
}
-
if (pos_x>9) {
-
pos_x = 9;
-
}
-
this._x = pos_x*40-180;
-
}
-
if (this.falling) {
-
this._y += 20;
-
pos_y = Math.floor((this._y+20)/40);
-
if ((pos_y == 0)or(field[pos_x][pos_y*(-1)-1]==1)) {
-
this.falling = false;
-
field[pos_x][pos_y*(-1)] = 1;
-
attach_sphere = true;
-
}
-
}
-
};
-
}
-
};
-
bar.onEnterFrame = function() {
-
dir = 0;
-
for (x=0; x<10; x++) {
-
for (y=0; y<6; y++) {
-
if (field[x][y]>0) {
-
if (x<5) {
-
dir -= (5-x);
-
} else {
-
dir += (x-4);
-
}
-
}
-
}
-
}
-
dir *= 0.01;
-
this._rotation += dir;
-
};
-
_root.onMouseDown = function() {
-
if (sphere.moving) {
-
sphere.moving = false;
-
sphere.falling = true;
-
}
-
};
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.
Tell me what do you think about this post. I'll write better and better entries.
» 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.
They can be easily customized to meet the unique requirements of your project.
6 Responses to “A new Flash game prototype”
Leave a Reply

Interesting, I’m glad most of your tuts now involve mathematics, which I lack in my code. :)
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
[...] 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 [...]
[...] just a prototype, but remember that BallBalance was started from this prototype and ended with this sponsorship… PLAIN TEXT [...]
very good!
[...] are the most interesting ways to make a game, remember what I was able to make from this to [...]