O'Reilly logo

Building Android Games with Cocos2d-x by Raydelto Hernandez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

We have added physics to our game by creating a physics world and physics bodies that represent the bomb and our player sprite, and we have used the collision detection mechanism provided by the built-in physics engine in a very few steps. We have also showed how to change the gravity parameters so that the physic bodies move according to the force of gravity. We have easily changed the physics properties of the bodies, such as velocity, friction, force, impulse, and torque with a single line of code for each of those. So far, our player ignores our user events. In the next chapter, we will cover how to add user interaction to our game.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required