Talking about Flash and Game development.
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
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
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.