Game Development Reference
In-Depth Information
Compile and run, and you should end up with…a blank scene. Success! If you run into
any problems, compare your project with the DoodleDrop01 project that accompanies
this topic.
Tip The app builds successfully but it won't run? Remember that there can be
multiple targets in an Xcode project, and even multiple schemes for a single tar-
get. Check the scheme selection / deployment target drop-down menu located
in the Xcode toolbar right next to the Run and Stop buttons (see Figure 2-6).
The left half of the drop-down menu allows you to choose the active scheme.
Make sure it's the one with the name DoodleDrop in it. Most other schemes like
cocos2d-library will be static libraries. You can only build static libraries, but
you can't run them. Unfortunately deleting, hiding or selecting schemes is a
per-user setting and must be done by each user individually. If not for that I
would have cleaned up the projects for you.
Adding the Player Sprite
Next you'll add the player sprite and use the accelerometer to control the player's ac-
tions. To add the player image, select the Resources group in Xcode and select File
Add Files to “DoodleDrop”… or, alternatively, right-click and from the context menu
pick Add Files to “DoodleDrop”… to open the File Picker dialog. If you accidentally
add files to the wrong group, you can also drag the file in the Project Navigator.
There's also nothing special about the Resources group—it's merely by definition sup-
posed to contain the files that are not source code.
The player images alien.png and alien-hd.png are located in the Resources
folder of the DoodleDrop project supplied with the topic. You can also choose your
own image, as long as it's 64 × 64 pixels in size and 128 × 128 pixels in the high-resol-
ution (HD) format, the file with the -hd suffix. The HD files are used automatically by
cocos2d on iPhone and iPod touch devices with Retina display; the regular standard-
definition (SD) files are used only on the iPhone 3GS. Cocos2d recognizes two other
file suffixes: -ipad for iPad and iPad 2 and -ipadhd for 3rd-generation iPads (and
newer) with Retina displays.
Search Nedrilad ::

Custom Search