O'Reilly logo

Cocos2D Game Development Essentials by Ben Trengrove

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

Firing objects from the catapult

You will now learn how to launch an object from the catapult. This will be accomplished by combining techniques into one smooth action, which you have already learned. Following are the steps:

  1. The first step to firing an object from the catapult is to actually make an object.
  2. Open SpriteBuilder and add a new node named Brick. Set bricks size to be (25, 25) and its anchor point to be (0.5, 0.5). Enable physics and set its density to a high value such as 50.0, and its friction to be 1.0, and its elasticity to 0.
  3. Add a color node to the node and give it an orange color to make it look more like a brick.
  4. Publish and switch back to Xcode.
  5. In order to fire an object, you will use the same techniques that you have already ...

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