diff options
Diffstat (limited to 'Wobble/ViewController.m')
| -rw-r--r-- | Wobble/ViewController.m | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Wobble/ViewController.m b/Wobble/ViewController.m index c419415..0443d4c 100644 --- a/Wobble/ViewController.m +++ b/Wobble/ViewController.m @@ -16,6 +16,7 @@ [self startScoreTimer]; } +// creates a new random location to move the ball to. -(CGPoint)createRandomLocationFor:(CGPoint)currentLocation { CGPoint newLocation = currentLocation; @@ -25,6 +26,7 @@ return newLocation; } +// moves the ball to a random location - (void)moveBallToRandomLocation { [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^ @@ -35,21 +37,25 @@ }]; } +// increment game score -(void)incrementScore { [self increaseScore:1]; } +// starts a timer that will move the ball to a random location - (void)startRandomLocationTimer { self.timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(moveBallToRandomLocation) userInfo:nil repeats:NO]; } +// starts a timer to increment the score while the game is running. - (void)startScoreTimer { [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(incrementScore) userInfo:nil repeats:YES]; } +// when the ball is touched -(void)onTouch:(UIGestureRecognizer *)sender { [self moveBallToRandomLocation]; |
