Working with the Power-Up Actor
In the previous section, we looked at the classes GameController
and Actor
and learned that the Actor
class requires a Representation
object to be displayed. The Representation
protocol describes what is required of a class to manage the UIView
associated with an actor. In this section, we will explore the class ImageRepresentation
and see how it uses images to represent an actor. In the preceding chapter, we used images to draw different actors. In this section, we will show how we can combine those techniques into a simple, reusable class called ImageRepresentation
.
To illustrate ImageRepresentation
, in our first example we will create power-ups and animate them across the screen, as shown in Figure 6–1.
Get Beginning iOS 5 Games Development: Using the iOS 5 SDK for iPad, iPhone, and iPod Touch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.