BallPusher: new Flash game prototype

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)

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     rad = 100;
  3.     r = 15;
  4. }
  5. onClipEvent (enterFrame) {
  6.     xdis = (this._x-_root._xmouse);
  7.     ydis = (this._y-_root._ymouse);
  8.     distance = Math.sqrt((xdis*xdis)+(ydis*ydis));
  9.     this._x = _root._xmouse += xdis/distance*rad;
  10.     this._y = _root._ymouse += ydis/distance*rad;
  11.     angle = Math.atan2(ydis, xdis);
  12.     this._rotation = angle*57.2957795;
  13.     for (i=0; i<5; i++) {
  14.         bi = _root["b"+i];
  15.         bi.r = (_root["b"+i]._width)/2;
  16.         xbidis = _root["b"+i]._x-this._x;
  17.         ybidis = _root["b"+i]._y-this._y;
  18.         bidis = Math.sqrt((xbidis*xbidis)+(ybidis*ybidis));
  19.         if (bidis<(this.r+bi.r)) {
  20.             force = bidis-(r+bi.r);
  21.             _root["b"+i]._x -= xbidis/bidis*force;
  22.             _root["b"+i]._y -= ybidis/bidis*force;
  23.         }
  24.     }
  25. }

While every ball has this code

ACTIONSCRIPT:
  1. onClipEvent (load) {
  2.     r = this._width/2;
  3.     this._x = random(400)+50;
  4.     this._y = random(300)+50;
  5. }
  6. onClipEvent (enterFrame) {
  7.     for (i=0; i<5; i++) {
  8.         bi = _root["b"+i];
  9.         bi.r = (_root["b"+i]._width)/2;
  10.         xbidis = _root["b"+i]._x-this._x;
  11.         ybidis = _root["b"+i]._y-this._y;
  12.         bidis = Math.sqrt((xbidis*xbidis)+(ybidis*ybidis));
  13.         if (bidis<(this.r+bi.r) && bidist != 0 && this.r>=bi.r && !_root["b"+i].hitTest(_root.pusher.inner)) {
  14.             force = bidis-(r+bi.r);
  15.             _root["b"+i]._x -= xbidis/bidis*force;
  16.             _root["b"+i]._y -= ybidis/bidis*force;
  17.         }
  18.     }
  19. }

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.

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
If you found this post useful, please consider a small donation.
» 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.

14 Responses to “BallPusher: new Flash game prototype”

  1. Xavi-v on March 7th, 2008 5:45 pm

    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

  2. Orava on March 7th, 2008 7:56 pm

    you need to push the balls speed and get them to certain area, something curlinglike… all i can think of

  3. Ben Forbes on March 7th, 2008 8:48 pm

    The direct link to the forum post is…

    http://www.triquitips.com/viewtopic.php?f=23&t=150

    … for impatient people :D

  4. FrozenHaddock on March 7th, 2008 10:17 pm

    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.

  5. Kesh on March 8th, 2008 2:14 am

    Seems kinda……boring.

    lol nice little engine though.

  6. Ciaren Coleman on March 8th, 2008 5:27 pm

    balls are flying around and you have to keep one safe?

  7. And Mar on March 8th, 2008 6:35 pm

    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.

  8. Grifo on March 8th, 2008 8:15 pm

    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.

  9. Monkios on March 10th, 2008 4:32 pm

    This could also be the bases of a shepherds game.

  10. Luiz Fernando on March 10th, 2008 8:56 pm

    Nice suggestions, guys :D

    I loved this prototype, it’s just fascinating!

  11. EagleVision on March 11th, 2008 8:08 pm

    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?

  12. a question on March 12th, 2008 6:52 pm

    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?

  13. ssusnic on May 7th, 2008 2:26 pm

    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.

Leave a Reply




Trackbacks

  1. Ballpusher concept | FrozenHaddock on April 13th, 2008 1:11 pm

    [...] yes, and it was featured on Emanuele Feronato, so I must be doing something [...]

Posts