Hello, i want to jump balls in a specific field in the view, the problem is that i don't know how to define the positions of this field area and movement. also here is the code that i use to move the ball in the entire view (the ball object is a uiimageview on the view). thanks.
-(void) onTimer { ball.center = CGPointMake(ball.center.x+pos.x,ball.center.y+pos.y);
if(ball.center.x > 320 || ball.center.x < 0)
pos.x = -pos.x;
if(ball.center.y > 460 || ball.center.y < 0)
pos.y = -pos.y;
}
// Implement viewDidLoad to do additional setup after loading the view. - (void)viewDidLoad { pos = CGPointMake(14.0,7.0);
[NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
}