0

im making a simple game on Xcode and i decided to use a nstimer in my .m xcode found 3 problems with my code it says Assigning to 'CGPoint' (aka 'struct CGPoint') from in compatable 'int' twice and it says use of undeclared game loop. Any help is great

@implementation ViewController 
@synthesize bg, rock, platform1, platform2, platform3, platform4, platform5, platform6, platform7;
@synthesize gameState;
@synthesize rockVelocity, gravity;


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void)viewDidLoad {
[super viewDidLoad];
gameState = kStateRunning;
rockVelocity = CGpointMake (0, 0);
gravity = CGpointMake (0, kGravity);

[NSTimer scheduledTimerWithTimeInterval: 1.0/60 target:self selector:@selector(gameLoop) userInfo:nil repeats:YES];

- (void)gameLoop {
   if (gameState == kStateRunning)
   {
       [self gameStatePlayNormal];
   }
    else if (gameState == kStateGameOver)
    {

    }
}
Erik Godard
  • 5,930
  • 6
  • 30
  • 33
Ethan Reid
  • 1
  • 1
  • 5

1 Answers1

1

You need to say CGPointMake (0, 0); You also need to make sure you declare the gameLoop function in your header file by saying

-(void)gameLoop;

Your viewDidLoad is also missing a closing bracket. Add one after your NSTimer method.

Erik Godard
  • 5,930
  • 6
  • 30
  • 33