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;
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); //加上这句话就会有那异常
}