Game Development Reference
In-Depth Information
Figure 8-6. A spaceship shooting three different sized bullets
In Figure 8-6 , we see a spaceship toward the bottom of the screen. There are a number of circles
above the spaceship; these are bullets that are shot out of the spaceship based on user gestures.
The cluster of three circles toward the upper left are the basic bullets, created from a simple tap. The
circle closest to the bottom is a bigger bullet, created when the user does a long press. If the user
does a touch that is longer than two seconds, an even bigger bullet is fired, as can be seen in the
upper right of Figure 8-6 . Let's take a look at the header file for the class LongPressController in
Listing 8-23.
Listing 8-23. LongPressController.h
@interface LongPressController : GameController{
Viper* viper;
NSDate* longStart;
}
-(void)tapGesture:(UITapGestureRecognizer*)tapRecognizer;
-(void)longPressGesture:(UILongPressGestureRecognizer*)longPressRecognizer;
-(void)fireBulletAt:(CGPoint)point WithDamage:(float)bulletSize;
@end
 
Search WWH ::




Custom Search