Game Development Reference
In-Depth Information
}
if (dataB=="cart" && dataA=="projectile") {
contact.SetEnabled(false);
}
}
There's nothing you haven't already seen when you learned how to handle
collisions. I just check for the cart and data to collide and disable the contact
with the setEnabled method.
8.
Test the movie and as promised you'll have your siege machine destroying
pigs' castle.
Everything worked fine, a new game concept is ready to be expanded, and we are
completely satisfied with it, aren't we?
To tell you the truth, in some cases you will notice that the projectile seems to pass
through a brick without touching it. Is it a Box2D bug? Or something wrong in the
contact callback? None of them, it's just a Box2D feature you haven't discovered
already, but you are about to soon.
Summary
In the longest and hardest chapter of the topic, you have learned how to use mouse,
distance, and revolute joints to bring gameplay to higher levels. Why don't you try
to build a catapult?
 
Search WWH ::




Custom Search