diff options
| author | mo khan <mo@mokhan.ca> | 2013-06-16 21:06:08 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-06-16 21:06:08 -0600 |
| commit | 8e32197300caae9e7206f05fae1df25027812296 (patch) | |
| tree | 236d9b5f8dd21771fb56821faddcc2d9b66b97a8 | |
| parent | 055ff3d3493c191f8c15dd1d2a5ca109541b927e (diff) | |
| -rw-r--r-- | Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate | bin | 16630 -> 16900 bytes | |||
| -rw-r--r-- | Wobble/ViewController.m | 6 | ||||
| -rw-r--r-- | WobbleTests/WobbleTests.m | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate b/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate Binary files differindex a8c37ca..52dae06 100644 --- a/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Wobble.xcodeproj/project.xcworkspace/xcuserdata/mo.xcuserdatad/UserInterfaceState.xcuserstate 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]; diff --git a/WobbleTests/WobbleTests.m b/WobbleTests/WobbleTests.m index e0e6531..8c2d8c4 100644 --- a/WobbleTests/WobbleTests.m +++ b/WobbleTests/WobbleTests.m @@ -26,7 +26,7 @@ - (void)testExample { - STFail(@"Unit tests are not implemented yet in WobbleTests"); + } @end |
