Book Image

Learning iPhone Game Development with Cocos2D 3.0

By : Kirill Muzykov
Book Image

Learning iPhone Game Development with Cocos2D 3.0

By: Kirill Muzykov

Overview of this book

Table of Contents (19 chapters)
Learning iPhone Game Development with Cocos2D 3.0
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – limiting the aiming range


Currently, we can just tap on the bird and the hunter will hit it. This is not very competitive; it would be harder to hit the bird if we needed to touch the screen closer to the hunter. We're going to limit the distance from the hunter where you can tap to aim.

At the end of the previous chapter, we added a bunch of images that we're going to use. There is one special image called power_meter.png, which we will use to show the aiming range.

Note

The power_meter.png image represents an arrow colored in white. Don't worry if you can't see it in the finder thumbnails or in preview, as you just can't see white image on a white background. If you want to see the image, you can open power_meter.png from the Chapter_04/Assets/Spritesheet/hd folder in the preview application. Later, it will become clear why we've used the white color.

Now, we're going to use this image in the code. Follow these steps to display the aiming indicator and limit the aiming range...