cgpoint - I'm Having Problems with NSTimer in Xcode -
im making simple game on xcode , decided use nstimer in .m xcode found 3 problems code says assigning 'cgpoint' (aka 'struct cgpoint') in compatable 'int' twice , says use of undeclared game loop. great
@implementation viewcontroller @synthesize bg, rock, platform1, platform2, platform3, platform4, platform5, platform6, platform7; @synthesize gamestate; @synthesize rockvelocity, gravity; // implement viewdidload additional setup after loading view, typically 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) { } }
you need cgpointmake (0, 0); need make sure declare gameloop function in header file saying
-(void)gameloop;
your viewdidload missing closing bracket. add 1 after nstimer method.
Comments
Post a Comment