我有一个小编,在编译时效果很好,每次我都是如此 编译它,它给了我错误:
-(void) addHeroCar{
CGSize screenSize = [CCDirector sharedDirector].winSize;
sprite = [CCBodySprite spriteWithFile:@"carNew.png"];
sprite.world = self;
sprite.physicsType = kDynamic;
sprite.collisionType = kBoxCollisionType;
sprite.collidesWithType = kBoxCollisionType | kWallCollisionType;
sprite.position = ccp(screenSize.width / 2, [sprite boundingBox].size.height / 2);
sprite.density = 0.7f;
sprite.friction = 0.3f;
[sprite addBoxWithName:@"box"];
[self addChild:sprite z:1 tag:HERO_TAG];
sprite.fixed = YES;
}
并且调试器显示以下错误:
-(void) addChild: (CCNode*) child z:(int)z tag:(int) aTag
{
NSAssert( child != nil, @"Argument must be non-nil");
我正在使用来自其他开发者的cocos2d + box2d包装器,仅供参考。
有什么建议吗?
此致 米尔扎