“isKindOfClass”始终在Cocos2d中测试为True

时间:2013-01-21 19:58:54

标签: iphone ios macos cocos2d-iphone

我已经在我的Cocos2d应用程序中为CCSprite实现了自己的自定义子类,但是当我遍历我的孩子时,我的isKindOfClass为我的CCLabelTTf返回true,而CCLabelTTf不是我的GameCharacter的子类。

    CCArray *listOfGameObjects = [self children];
      for (id tempObj in listOfGameObjects) {
        if ([tempObj isKindOfClass:[GameCharacter class]]) {
          GameCharacter *gameChar = (GameCharacter*)tempObj;
          [gameChar updateStateWithDeltaTime:delta andListOfGameObjects:listOfGameObjects];
        }  
      }

0 个答案:

没有答案