The code I am now using:
Code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
startTouchPosition = [touch locationInView:self];
character.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"character.png"],
[UIImage imageNamed:@"character2.png"], nil];
character.animationDuration = 0.5;
character.animationRepeatCount = 1;
[character startAnimating];
[self.view addSubview:character];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self];
if (currentTouchPosition.y > startTouchPosition.y) {
[self characterJump:touches withEvent:event]; }
CGPoint location = [touch locationInView:touch.view];
CGPoint xLocation = CGPointMake(location.x,character.center.y);
character.center = xLocation;
}
-(void) characterJump {
}
But Xcode tells me that I have not declared startTouchPosition, and that warning: incompatible Objective-C types 'JumpViewController*', expected 'UIView*' when passing argument 1 of 'locationInView:' from distinct Objective-C type??