Fish* Fish::create(FishType type) { Fish* fish = new Fish(); fish->init(type); fish->autorelease(); return fish; }
Fish* Fish::create() { Fish *sprite = new Fish(); if (sprite && sprite->initWithFile("turtle_1.png")){ sprite->setup(); sprite->autorelease(); return sprite; } CC_SAFE_DELETE(sprite); return nullptr; }
Fish* Fish::create(FishType type/* = k_Fish_Type_SmallFish */) { Fish* fish = new Fish; if (fish && fish->init(type)) { fish->autorelease(); return fish; } else { CC_SAFE_DELETE(fish); return NULL; } }
Fish *Fish::createWithFishType(int fishType, GameLayer *gameLayer, CCSpriteBatchNode *pBatchNode) { Fish *fish = new Fish(); if(fish && fish->initWithFishType(fishType, gameLayer, pBatchNode)) { fish->autorelease(); return fish; } else { delete fish; return NULL; } }