Game Development Reference
In-Depth Information
If you test the movie now and then click on a body, you'll see the following
text in the output window:
[object b2Body]
Now we know which body the player clicked on, it's time to destroy it
for real. To remove a body from the world, use the world's DestroyBody
method and finally you are able to smash the totem.
private function queryCallback(fixture:b2Fixture):Boolean {
var touchedBody:b2Body=fixture.GetBody();
world.DestroyBody(touchedBody);
return false;
}
6.
Test the movie. Click on a brick and you will see it disappear, destroying
the totem:
Anyway, we still have a problem. In Totem Destroyer, not all of the bricks can
be destroyed, but at the moment if you click on any of them, you will destroy it.
Moreover, you can even destroy the idol and the ground itself.
 
Search WWH ::




Custom Search