Online Book Reader

Home Category

iPhone Game Development - Chris Craft [50]

By Root 1616 0

Any time you finish an application you should take a step back and perform a quick mental post-mortem. What went right? What went wrong? What could you have done better? What will you do differently next time? Also take some time and think about where you will go from here. We recommend taking the iFlame application you have and creating some new effects of your own. For example, you could create a campfire application or a fireplace application for the iPhone. Maybe you could blow out the fire in the fireplace by blowing on the iPhone's microphone. Users would enjoy this because it would remind them of the famous Three Little Pigs children's story.

FIGURE 4.7

The final iFlame application running in the Simulator


Since you now have a solid template for playing videos in your applications, another enhancement idea you can consider for the application, and for others you may create, is to create a video splash screen that you play when the user first runs your application. People have come to expect this high level of professionalism from movies, but it is still rare in iPhone applications. Instead of boring text that tells users about your other products, have you considered creating exciting 10-second video commercials? You would only need to add a new screen, then have some thumbnails to allow viewers to pick which of your applications they are interested in.

Programming: iDrum

Let's now take a look at creating another novelty application. This time you will create a virtual drum for the iPhone. The iDrum features a great graphic and sound effect of a drum. You can use the ones we provide or ones of your own. When you are done, you should end up with an application that looks something like the one in Figure 4.8.

To create a virtual drum for the iPhone, follow these steps:

1. Open Xcode and choose File⇒New Project.

2. You will use the Utility Application project template that can be found under the iPhone OS application. Select the Utility Application project template and click the Choose button at the bottom right.

3. Save the new project in a location to your liking and name it iDrum.

4. Locate the Default.png file that is included with the chapter's materials.

5. Expand the Resources folder that is located in the Groups & Files panel on the left side of Xcode. Right-click on this folder and choose Add⇒Existing Files. Browse until you locate the Default.png file that you located earlier and select it, then click the Add button at the bottom right of the dialog box.

6. Locate the drumbeat.caf file that should also be included in this chapter's materials where you found the Default.png. This is the sound that the iDrum makes when the user taps it. Repeat the same process as before to add the drumbeat.caf to your iDrum project's resources.

7. Do the same for the drum.png and the drumIcon.png files.

You should always include a Default.png in all of your applications. The iPhone displays the Default.png during the time it takes to load the application. This keeps the user from seeing a blank black screen and wondering if the application is locked up. You can either use the Default.png as an application splash screen as we have done (Figure 4.9), or you can use it to make the application appear to load faster.

You can see a good example of this effect in Apple's iPhone applications; in particular, the Clock application. When you first start the iPhone's Clock application, for the first second or two what you see is actually an image that is being used as the Clock's Default.png on application startup. You can see this image in Figure 4.10. It might not look like much, but this screen is very similar to what the iPhone's Clock application looks like when it is running. Basically all of the background elements for the Clock application are drawn to the screen so it is almost ready even before the application starts.

FIGURE 4.8

The iDrum application


FIGURE 4.9

The iDrum's Default.png


Once the Clock application has finished loading, it takes over screen output and you finally see the

Return Main Page Previous Page Next Page

®Online Book Reader