Hello, this is the code im using currently to move my ship along an X-axis, right now it responds to any touch on the screen and automatically centers on the Y-axis of were the touch is located. Now I want it to only respond to touches on the ship, how would I do this?
Code:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
CGPoint xLocation = CGPointMake (location.x,ship.center.y);
ship.center = xLocation;
info.text = nil;
}