我的 “child—>m_pParent ==0” 的异常

来源:互联网 发布:淘宝宝贝描述代码下载 编辑:程序博客网 时间:2024/06/08 00:11
bool HeroLayer::init(){
bool Ret=false;
do 
{  
CC_BREAK_IF(!CCLayer::init());

CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("pd_sprites.plist");
_actors = CCSpriteBatchNode::create("pd_sprites.pvr.ccz");
_actors->getTexture()->setAliasTexParameters();
this->addChild(_actors, -1);
initHero();



this->setTouchEnabled(true);
Ret=true;
} while (0);


return Ret;

};


void HeroLayer::initHero(){
_hero = Hero::create();
_actors->addChild(_hero);
_hero->setPosition(ccp(400,240));
//this->addChild(_hero);     //加上这句话就会有那异常


}