I was going through a list of games that I've programmed recently and was reminded about Dynamite Fishing, a game we (at Electrotank) created for Comedy Central. For that game I programmed a series of wave physics classes that shows waves moving through water at a side view.
I had fun creating that and thought that I'd rewrite it a little more cleanly for ActionScript 3 and make the source available. It allows you to inject waves at any x position with any amplitude. Waves obey superposition - that means that you can continually inject waves and they'll add/subtract each other to produce the appropriate result.
In the source provided you can specify any DisplayObject to show up and float in the water.
In the example below you can just click anywhere to inject a wave. Notice too that the water never quite settles down. That's because I set it up to inject a small disturbance at random intervals.
CLICK

6 comments:
Umm... Awesome!
-Steve
Hmmm, can I use this sourcecode in my games?
Yes.
Very nice. Thanks for sharing.
just wanted to again say...thanks for sharing some awesome code!
Wicked. Cool of you to share.
Post a Comment