Game Development Reference
In-Depth Information
4.
Test the movie, move the siege machine left and right, and fire with the up
arrow key.
This has been a huge achievement. Building a siege machine with Box2D is not easy,
but you managed to do it. It's time to kill some pigs.
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();
bodyDef.position.Set(320/worldScale,465/worldScale);
var polygonShape:b2PolygonShape=new b2PolygonShape();
polygonShape.SetAsBox(320/worldScale,10/worldScale);
var fixtureDef:b2FixtureDef=new b2FixtureDef();
fixtureDef.shape=polygonShape;
var groundBody:b2Body=world.CreateBody(bodyDef);
groundBody.CreateFixture(fixtureDef);
}
 
Search WWH ::




Custom Search