Game Development Reference
In-Depth Information
Figure 5-4. Simple Movement
In Figure 5-4 , we see a spaceship from a top-down perspective with a star field in the background.
When the user touches any point on the screen, the ship will animate to that point. This type of
animation could easily be accomplished using the type of animations presented in the previous
chapter, but this will not provide us with a good starting point. In terms of views, what you are seeing
in Figure 5-4 , ignoring the top navigation bar, is a UIView with two UIImageView subviews. One of the
UIImageView s is the background star field and the other is the spaceship. The basic idea here is that
we can periodically update the location of the UIImageView of the spaceship to create an animation.
Like our other examples, the logic for managing the state of these different UIView s is located in
a UIViewController subclass. For this example, the class is called Example01Controller and its
header files are shown in Listing 5-1.
Listing 5-1. Example01Controller.h
#import <UIKit/UIKit.h>
#import <QuartzCore/CADisplayLink.h>
#import "Viper01.h"
Search WWH ::




Custom Search