Reputation: 124
I have been asking a lot of questions lately, sorry. I get an error when < shows up.
-(void) SpritesDidCollide {
CCNode *player = [self getChildByTag:kTagPlayer];
CCNode *computer = [self getChildByTag:kTagComputer];
float xDif = computer.position.x - player.position.x;
float yDif = computer.position.y - player.position.y;
float distance = sqrt(xDif * xDif + yDif * yDif);
if (distance < 45;) { //--------------------Right Here-------------------
[self unschedule:@selector(SpritesDidCollide)];
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1 scene:[GameOver node]]];
}
}
Upvotes: 1
Views: 411
Reputation: 828
Look at 'Signature not found for selector - does it have the following form? -(void) name: (ccTime) dt'
your selector (SpritesDidCollide) isn't accepting ccTime...
change
-(void)SpritesDidCollide
to
-(void)SpritesDidCollide:(ccTime)dt
and change
[self unschedule:@selector(SpritesDidCollide:)]; // Note added colon : after method name
May also need to change the schedule call and add the colon : where ever you initially set it up
[self schedule: @selector(SpritesDidCollide:)];
Upvotes: 1
Reputation: 1294
if (distance < 45;) {
Take a look again. To compare use comparison operators such as '==', '<', '>', '<=', '>='.
Inside of brackets in your case we do not need ';'.
'(expression ;)' such construction is not acceptable.
if (distance < 45) {
Upvotes: 0