From 8e32197300caae9e7206f05fae1df25027812296 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 16 Jun 2013 21:06:08 -0600 Subject: add comments --- Wobble/ViewController.m | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Wobble/ViewController.m') 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]; -- cgit v1.2.3