use of undeclared identifier in Xcode
I'm making an simple game, and Xcode finds a bug says that there is a "use
of undeclared identifier 'gameLoop'". How can I fix this?
// Implement viewDidLoad to do additional setup after loading the view,
typically from a nib.
(void)viewDidLoad {
[super viewDidLoad];
gameState = kStateRunning;
[NSTimer scheduledTimerWithTimeInterval: 1.0/60 target:self
selector:@selector(gameLoop) userInfo:nil repeats:YES];
rockVelocity = CGPointMake (0, 0); gravity = CGPointMake (0,
kGravity); - (void)gameLoop {
if (gameState == kStateRunning)
{
[self gameStatePlayNormal];
}
else if (gameState == kStateGameOver)
{
}
}
(void)gameStatePlayNormal {
rockVelocity.y += gravity.y;
rock.center = CGPoint(rock.center.x + ballVelocity.x,rock.center.y
+ rockVelocity.y);
No comments:
Post a Comment