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)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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.

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...
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.
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 14 comments

  1. Xavi-v

    on March 7, 2008 at 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 7, 2008 at 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 7, 2008 at 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 7, 2008 at 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 8, 2008 at 2:14 am

    Seems kinda……boring.

    lol nice little engine though.

  6. Ciaren Coleman

    on March 8, 2008 at 5:27 pm

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

  7. And Mar

    on March 8, 2008 at 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 8, 2008 at 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 10, 2008 at 4:32 pm

    This could also be the bases of a shepherds game.

  10. Luiz Fernando

    on March 10, 2008 at 8:56 pm

    Nice suggestions, guys :D

    I loved this prototype, it’s just fascinating!

  11. EagleVision

    on March 11, 2008 at 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 12, 2008 at 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. Ballpusher concept | FrozenHaddock

    on April 13, 2008 at 1:11 pm

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

  14. ssusnic

    on May 7, 2008 at 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.