Game Development Reference
In-Depth Information
Figure 5-12. Images that make up the animation for asteroid variant B
In Figure 5-12 , we see 31 images of asteroids. If the images are showed in succession, moving from
the top left to the bottom right, it will appear as if the asteroid is rolling. The animation is a loop, so
the first image can be shown after the last, creating a smooth animation. To understand how we
implement this animation, let's take a look at the header file for the update class Actor03 , as shown
in Listing 5-20.
Listing 5-20. Actor03.h
#import <Foundation/Foundation.h>
@class Example03Controller;
long nextId;
@interface Actor03 : NSObject {
}
@property (nonatomic, retain) NSNumber* actorId;
@property (nonatomic) CGPoint center;
@property float rotation;
@property (nonatomic) float speed;
@property (nonatomic) float radius;
@property (nonatomic, retain) NSString* imageName;
@property (nonatomic) BOOL needsImageUpdated;
-(id)initAt:(CGPoint)aPoint WithRadius:(float)aRadius AndImage:(NSString*)anImageName;
-(void)step:(Example03Controller*)controller;
-(BOOL)overlapsWith: (Actor03*) actor;
@end
Search WWH ::




Custom Search