Putting it all together

Time to take all of our Box2D knowledge and put it all together, to create the ultimate mix between Angry Birds and Crush the Castle.

  1. First, we modify a little the ground function to let it create the ground in the same place as we created it during our latest Angry Birds prototype:
    private function ground():void {
      var bodyDef:b2BodyDef=new b2BodyDef();
      var polygonShape:b2PolygonShape=new b2PolygonShape();
      var fixtureDef:b2FixtureDef=new b2FixtureDef();
      var groundBody:b2Body=world.CreateBody(bodyDef);
  2. Then, we need to update the Main function to include ...

Get Box2D for Flash Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.