Talking about Actionscript 3, Box2D, Flash and Game development.
You know with Box2D you can make interesting games like Mazeroll, SamePhysics or Filler, but even if I published a Box2D tutorial for absolute beginners, everyday I am receiving emails complaining about the excessive complexity of this library.
If you are looking for a library able to simplify your Box2D projects, Zevan Rosser from ActionSnippet developed a library called QuickBox2D that promises to significantly simplify instantiation of rigid bodies and provide a simple way to skin rigid bodies with custom graphics.
In this quick example I am going to add a sphere to the stage and make it draggable.
Before looking at this script, take a look at Dragging objects with Box2D Flash to see how many lines of code I needed to make those crates draggable.
This is what you need with QuickBox2D:
package {
import flash.display.MovieClip;
// importing required library
import com.actionsnippet.qbox.*;
// it must be a MovieClip!! With a Sprite it won't work!
public class quickbox extends MovieClip {
public function quickbox() {
// setting up the QuickBox2D world
var qb:QuickBox2D=new QuickBox2D(this);
// default fill color
qb.setDefault({lineAlpha:0, fillColor:0xff0000});
// automatic stage walls creation!!!!!!!
qb.createStageWalls();
// adding a ball... that easy...
var ball:QuickObject=qb.addCircle({x:3,y:3,restitution:0.9,lineAlpha:1,fillColor:0x00ff00,allowSleep:false,fixedRotation:true});
// automatic mouse dragging!!!
qb.mouseDrag();
// starting the simulation
qb.start();
}
}
}
and this is what you get…
And this is the source code with all libraries in the correct path.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.