Search code examples
flashactionscript-3physics-engine

ActionScript-3 physics libraries


I want to write a game in which there will be some balls on the stage, that will move randomly. They must have unique starting speed and angle and should interfere with each other just like real billiard balls. Is there any physics engine in AS3 that might be useful for this purpose, or will I have to write and model their behavior from the scratch?


Solution

  • well, doing so "from scratch" isn't really much of a challenge if you know what to do. if you're interested in learning i would suggest you pick up Keith Peters' Foundation ActionScript 3.0 Animation book. one benefit from studying the lessons in the book (and perhaps the book's sequel) is that all of the algorithms and logic are easily portable to other languages.

    that being said, i believe the most popular physics engine for Flash currently is the popular C++ engine Box2D, which was recently ported to AS3 using Adobe's Alchemy. included in the ActionScript port is a "World Construction Kit" component for Flash Professional.

    more here: Box2d Flash Alchemy Port + World Construction Kit