cocos2d addChild每秒都会失败

时间:2011-11-29 13:37:21

标签: iphone objective-c

我有一个小编,在编译时效果很好,每次我都是如此 编译它,它给了我错误:

-(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包装器,仅供参考。

有什么建议吗?

此致 米尔扎

0 个答案:

没有答案