summaryrefslogtreecommitdiff
path: root/Wobble
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-06-16 21:06:08 -0600
committermo khan <mo@mokhan.ca>2013-06-16 21:06:08 -0600
commit8e32197300caae9e7206f05fae1df25027812296 (patch)
tree236d9b5f8dd21771fb56821faddcc2d9b66b97a8 /Wobble
parent055ff3d3493c191f8c15dd1d2a5ca109541b927e (diff)
add commentsHEADmaster
Diffstat (limited to 'Wobble')
-rw-r--r--Wobble/ViewController.m6
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];