BallPusher: new Flash game prototype
Posted by Emanuele Feronato on 03/7/08 in Flash, Game design, 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.
If you liked this post buy me a beer (or two) » 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.
tag this
Xavi-v | Mar 7, 2008 | Reply
does anyone have any ideas of what kind of game to make with this prototype?
the best i can think of is like to get the balls in a certain area in a limited amount of time…i’m not even going to bother making that cuz i know it will be boring
Orava | Mar 7, 2008 | Reply
you need to push the balls speed and get them to certain area, something curlinglike… all i can think of
Ben Forbes | Mar 7, 2008 | Reply
The direct link to the forum post is…
http://www.triquitips.com/viewtopic.php?f=23&t=150
… for impatient people :D
FrozenHaddock | Mar 7, 2008 | Reply
Modifying this to use x and y speeds so the balls slide and bounce would make for an interesting avoidance game.
Perhaps you have 3 balls in the centre, and other enemy balls come in from the side and try to knock your balls out of a ring. You use the rod/ballpushery thing to defend against the enemies and to reposition your defendable balls.
Just a thought.
Kesh | Mar 8, 2008 | Reply
Seems kinda……boring.
lol nice little engine though.
Ciaren Coleman | Mar 8, 2008 | Reply
balls are flying around and you have to keep one safe?
And Mar | Mar 8, 2008 | Reply
2 ideas that require minor changes…
1) You can swing the “pusher” around really fast with your mouse and wack balls into targets.
2) #1 turned into a slingshot. You hold the mouse down and the ball sticks to the end. When you let go it flies off.
Grifo | Mar 8, 2008 | Reply
And Mar’s Idea seem cool , especially the scond part. I believe that in that case the speed of the pusher in the frame you release the mouse button should be directly proportional to the power and speed of the launched object. That can make something good.
Monkios | Mar 10, 2008 | Reply
This could also be the bases of a shepherds game.
Luiz Fernando | Mar 10, 2008 | Reply
Nice suggestions, guys :D
I loved this prototype, it’s just fascinating!
EagleVision | Mar 11, 2008 | Reply
Yeah!
I like it…Does anybody like this prototype?
http://eagleproductions.wordpress.com/2008/03/05/brand-new-flash-prototypemake-a-ball-bounce-on-things/
You can, stump on things.Just remember to make the green box alpha…fun?
a question | Mar 12, 2008 | Reply
Hey emanuele(or someone else who can help me)
ive got a question can i make a hittest with two objects and then flash shows me cordinats where the two are hittesting?
ssusnic | May 7, 2008 | Reply
Hi, everybody!
Here you can play my game named Polar Solar which is based on BallPusher prototype:
http://www.askforgametask.com/games/polarsolar/
Although the game is pretty simple, it has got an exclusive sponsorship. Of course, FrozzenHaddock and LuizZak as authors of the prototype are credited in the game.