Game Development Reference
In-Depth Information
Listing 8-27. LongPressController.m (fireBulletAt:WithDamage:)
-(void)fireBulletAt:(CGPoint)point WithDamage:(float)damage{
Bullet* bullet=[Bullet bulletAt:[viper center] TowardPoint:point];
[bullet setDamage:damage];
[self addActor:bullet];
}
In Listing 8-27, we see that we simply create a new Bullet actor that is configured to travel toward a
specified point and add it the scene.
Swipe Gesture
The swipe gesture is probably most recognizable as the gesture used to switch the set of apps you
see on the home screen. This gesture is often used to switch context, as with the home screen.
Other examples include the four-finger swipe used to switch the foreground application on the iPad
2 and 3. It is a bit like pawing your way through your running applications. In our example, we are
going to use swipe gestures to add comets to the scene, as shown in Figure 8-7 .
Figure 8-7. Swipes create comets
 
Search WWH ::




Custom Search