Talking about BallPusher game, Flash, Game development and Users contributions.
Here it is another fresh Flash game prototype by FrozenHaddock, that jumps from the forum to the blog. FrozenHaddock was playing around with Flash as he says, when he come out with an interesting prototype.
Something I was fiddling about with, might work well as a puzzle game of some
sort. Some people might find it interesting :)
I found it very interesting… and probably I’ll turn it into a complete one-day game.
In this prototype actionscript is not in a single frame but every object has its own code.
This is the code for the pusher (that’s not a drug dealer in this case)
onClipEvent (load) {
rad = 100;
r = 15;
}
onClipEvent (enterFrame) {
xdis = (this._x-_root._xmouse);
ydis = (this._y-_root._ymouse);
distance = Math.sqrt((xdis*xdis)+(ydis*ydis));
this._x = _root._xmouse += xdis/distance*rad;
this._y = _root._ymouse += ydis/distance*rad;
angle = Math.atan2(ydis, xdis);
this._rotation = angle*57.2957795;
for (i=0; i<5; i++) {
bi = _root["b"+i];
bi.r = (_root["b"+i]._width)/2;
xbidis = _root["b"+i]._x-this._x;
ybidis = _root["b"+i]._y-this._y;
bidis = Math.sqrt((xbidis*xbidis)+(ybidis*ybidis));
if (bidis<(this.r+bi.r)) {
force = bidis-(r+bi.r);
_root["b"+i]._x -= xbidis/bidis*force;
_root["b"+i]._y -= ybidis/bidis*force;
}
}
}
While every ball has this code
onClipEvent (load) {
r = this._width/2;
this._x = random(400)+50;
this._y = random(300)+50;
}
onClipEvent (enterFrame) {
for (i=0; i<5; i++) {
bi = _root["b"+i];
bi.r = (_root["b"+i]._width)/2;
xbidis = _root["b"+i]._x-this._x;
ybidis = _root["b"+i]._y-this._y;
bidis = Math.sqrt((xbidis*xbidis)+(ybidis*ybidis));
if (bidis<(this.r+bi.r) && bidist != 0 && this.r>=bi.r && !_root["b"+i].hitTest(_root.pusher.inner)) {
force = bidis-(r+bi.r);
_root["b"+i]._x -= xbidis/bidis*force;
_root["b"+i]._y -= ybidis/bidis*force;
}
}
}
And this is the result:
Download the source code and make it a playable game!
Special thanks to FrozenHaddock for sharing this code. He also runs a site, check it out.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.