Online Book Reader

Home Category

iPhone Game Development - Chris Craft [21]

By Root 1534 0
Think about how they apply to cars, for example. People expect their cars to function properly, but they also want them to look great. What's the difference between a low-end car and a high-end car? Usually you will find great quality in how the high-end car runs, works, and looks. And along with this increase in quality you will find an increase in profit to the manufacturer. Keep this in mind when you are deciding how much time and money to invest in your future iPhone applications.

Here are some ideas to consider for making the Hello World app even better:

Have an animated Earth graphic that revolves.

Have the Earth graphic zoom in from far away to up close.

Get the user's location programmatically from his device. Then center the Earth graphic on this location, and finally zoom out to space to see the full Earth graphic.

Have the Earth graphic respond to user touch, allowing rotation and zooming options.

Have the Earth graphic respond back by displaying the user name from the device database.

Have the device play a Hello World audio recording.

Display the Hello World text first in one language and then in others over time.

Have the Hello World text scroll across the screen in a large, banner-size font.

Start from a star field perspective and zoom in on the Earth graphic when the user touches the screen.

Have an animated star field background behind the Earth graphic to show motion effect.

Have an animated moon graphic, or at least a full-sphere moon graphic similar to the Earth image.

All of these ideas are great, but of course, you cannot do every one of them. Since this is the first application you will create, don't make it your most challenging. Instead, focus on a single feature that will give you the most return for your investment of time and effort. Here is the idea that will be the most exciting for end users to experience, and easy for new developers to program: Display the Hello World text first in one language and then in others over time. You will learn to make the foundation for this application in the sections ahead. From there you should be in a position to experiment and try some of the ideas listed above on your own.

Xcode

Now you are ready to create a Hello World app of your very own. Open Xcode and choose File⇒New Project. Under iPhone OS, choose Application, and then choose the Utility Application template (Figure 2.16). Save the New Project as HelloWorldEx.

Xcode now generates all the base code files required for your HelloWorldEx utility project (Figure 2.17). Specifically, Xcode creates a Main View, a Flipside View, and all the navigation controls and plumbing you need to move between these two views. You will use the Main View for all of the core functionality of the application, and save the flipside view for an About Us screen.

The iPhone's screen resolution is 320 pixels wide by 480 pixels tall. You will make your Hello World application run full-screen so that you can take advantage of every pixel of screen space. But first you will add all of your application's graphic assets to the application project. You can either create your own or use the ones included in the book's sample code. The first file is called starfield.png and is a nice image of stars in space. This will be used as your background image. On top of this you will place the earth.png file, an image of the Earth. This is the main graphic of the application, and will be placed in the center of the screen.

FIGURE 2.16

Xcode New Project dialog box


FIGURE 2.17

Hello World opened inside of the Xcode Project Explorer


On the left-hand side of the Xcode Project Explorer you will see a Groups & Files list. Double-click on the Resources folder to expand it and choose Project⇒Add to Project. Find the files starfield.png and earth.png, click on them, and click Add. Be sure to check the Copy items into destination group's folder (if needed) check box on the next dialog box. The rest of the settings can remain on their default settings.

Tip

Using separate image files for the Earth and stars

Return Main Page Previous Page Next Page

®Online Book Reader