
913.9 User Input
CGPoint p = [touch locationInView:self];
[player setTouch: p];
int x = p.x;
int y = p.y;
NSLog(@"Touch moves at%i,%i", x, y);
}
If you keep your nger on the display, you can drag the zombie behind it and thereby
keep it going indenitely. But we have achieved even more. e code also shows a pos-
sible implementation of the swipe gesture. You can control the zombie not only by a
single tap and continuous movement, but also by a swipe; if you tap the zombie and then
quickly swipe your nger in another direction, the gure follows your nger until you
release it.
For many games, you need a motion control that is active only ...