Gravity 2 - now with Flex!

Many years ago, I wrote (in concert with Dave) a little gravity simulator in flash. By “gravity simulator”, I mean there were a few graphics representing planets, your mouse was the sun, and things moved about in some interesting patterns. Not exacly a model for our solar system, but fun to play with. The interesting part was that each planet had to calculate it’s gravitational pull against all the other planets. Thus increasing the planet count increased the number of calculations exponentially.

In the spirit of all the Flex sessions I had recently at Max, I’ve built a new version using ActionScript 3 and MXML.

Here is the new version: Gravity2 (requires flash player 9)
And here is the source code, use at your own risk. Quite interesting how many planets it can handle on AS3 code (100+) versus the original AS1 code (15+). By the way, keyboard commands include the spacebar, up, down, plus and minus keys - you’ll see which is which.

And here is the old version: Original Gravity

Tags:

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*