Monday, 19 August 2013

use of undeclared identifier in objective-c

use of undeclared identifier in objective-c

I'm new to programing and I am making a simple game. Xcode found a bug in
my program and it says use of undeclared 'gameStatePlayNormal . Any help
would be amazing!! This is my .m file where it is finding the bug.
-(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);
}
here is my .h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
// Image View for the game mode
UIImageView *bg;
UIImageView *rock;
UIImageView *platform1;
UIImageView *platform2;
UIImageView *platform3;
UIImageView *platform4;
UIImageView *platform5;
UIImageView *platform6;
UIImageView *platform7;
NSInteger gameState;
CGPoint rockVelocity;
CGPoint gravity;
}
@property (nonatomic, retain) IBOutlet UIImageView *bg;
@property (nonatomic, retain) IBOutlet UIImageView *rock;
@property (nonatomic, retain) IBOutlet UIImageView *platform1;
@property (nonatomic, retain) IBOutlet UIImageView *platform2;
@property (nonatomic, retain) IBOutlet UIImageView *platform3;
@property (nonatomic, retain) IBOutlet UIImageView *platform4;
@property (nonatomic, retain) IBOutlet UIImageView *platform5;
@property (nonatomic, retain) IBOutlet UIImageView *platform6;
@property (nonatomic, retain) IBOutlet UIImageView *platform7;
@property (nonatomic) NSInteger gameState;
@property (nonatomic) CGPoint rockVelocity;
@property (nonatomic) CGPoint gravity;
- (void)gameStatePlayNormal;
@end

No comments:

Post a Comment