O'Reilly logo

Cocos2d for iPhone 0.99 Beginner's Guide by Pablo Ruiz

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

Time for action - making bombs explode

We will now use our first particle system. These particles will represent the explosion caused by dropping a bomb. What we'll do first is create the logic for the bomb, and then have the game create a particle system.

The game will start with three bombs, each time the player touches the screen with two fingers, one bomb will be dropped, and this bomb will destroy every enemy on the screen. So what we have to do is detect a two finger touch on the screen, create the particle system, remove every active enemy, and update the remaining bombs label. So, let's get on with it.

  1. First add a new BOOL property to the GameLayer, and name it canLaunchBomb. This will help us to prevent the player from dropping three bombs ...

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