¿Por qué la colisión no funciona, cocos2d v3?
creo un juego simple como flapy bird con cocos2d v3. Clase de interfaz:
@interface GameScene : CCScene<CCPhysicsCollisionDelegate>
// -----------------------------------------------------------------------
+ (GameScene *)scene;
- (id)init;
// -----------------------------------------------------------------------
@end
En el archivo .m:
_physicsWorld =[CCPhysicsNode node];
_physicsWorld.gravity=ccp(0, 0);
_physicsWorld.collisionDelegate=self;
_physicsWorld.debugDraw =YES;
[self addChild:_physicsWorld];
.........
bird.physicsBody=[CCPhysicsBody bodyWithRect:(CGRect){CGPointZero,bird.contentSize} cornerRadius:0];
bird.physicsBody.collisionGroup=@"birdGroup";
bird.physicsBody.collisionType=@"birdCollision";
[_physicsWorld addChild:bird];
........
tubeBody.physicsBody.collisionGroup =@"tubeGroup";
tubeBody.physicsBody.collisionType=@"tubeCollision";
tubeBody.physicsBody.type=CCPhysicsBodyTypeStatic;
[_physicsWorld addChild:tubeBody];
-(BOOL)ccPhysicsCollisionBegin:(CCPhysicsCollisionPair *)pair typeA:(CCNode *)nodeA typeB:(CCNode *)nodeB{
[self endGame];
NSLog(@"end game");
return YES;
}
¿Por qué el método ccPhysicsCollisionBegin nunca llama?