Beginning iOS 5 Games Development: Using the iOS 5 SDK for iPad, iPhone, and iPod Touch by Lucas Jordan

Beginning iOS 5 Games Development: Using the iOS 5 SDK for iPad, iPhone, and iPod Touch by Lucas Jordan

Author:Lucas Jordan
Language: eng
Format: epub, pdf
Publisher: Apress®
Published: 2011-11-14T16:00:00+00:00


HealthBar* healthBar = [HealthBar healthBar:saucer];

[healthBar setPercent:1];

[saucer setHealthBar:healthBar];

[controller addActor:healthBar];

return saucer;

}

In Listing 7–3, we start by finding the center of the game area and storing that value in the CGPoint gameCenter. Next, we create an ImageRepresentation called rep. We indicate that rep should spin the saucer backward half the time at a rate of 3 steps per frame of animation. The CGRect gameCenter and the ImageRepresentation rep are passed to the super initializer initAt:WithRadius:AndRepresenation: to create a Saucer object with a radius of 32. The object saucer is then set as the delegate to the ImageRepresenation so we can specify the representational details with the class Saucer. This works exactly like the actors in Chapter 6. Have a look at the source code to see exactly how these tasks are implemented.

Once the saucer object is created, we want to initialize it with some details. We set which of the three variants we want to use by calling setVariant: on saucer. We also set the max health and current health properties to 100. Let's move on to the HealthBar class.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.