In Example 5.1, we get introduced to creating a custom contact listener, as well as how they work, and what they can be used to handle.
You can now find when certain objects are colliding, finished colliding, about to decide what to do once they have collided, as well as after they have collided, and have solved what they will be doing.
We also are able to see how hard an object has been hit, based on its “normal impulse”.
Download the source Code and please leave me any comments or feedback you have.
In Example 5.2, we are introduced to another form of checking the contacts of an object, without actually having to create a custom contact listener.
We are now able to check to see when our “idol” in the totem game collides with the floor, and are able to handle it whatever way we want to.
(click on certain bodies to destroy them)
Download the source Code and please leave me any comments or feedback you have.
In Example 5.3, we actually use a custom contact listener to check the normal impulse on both “pigs” and “blocks” in our Angry Birds like game, and remove them when they have been hit hard enough.
(Just like Angry birds, drag back the white circle “bird”, and let go to fling it)
Download the source Code and please leave me any comments or feedback you have.