PlayerSprite* PlayerSprite::create(GameLayer * game, int type, CCPoint position) { PlayerSprite *sprite = new PlayerSprite(game, type, position); if (sprite) { sprite->initPlayer(); sprite->autorelease(); return sprite; } CC_SAFE_DELETE(sprite); return NULL; }
PlayerSprite* PlayerSprite::create(string name, string photo, float winRate) { PlayerSprite *sprite = new (std::nothrow) PlayerSprite(name, photo, winRate); if (sprite && sprite->init()) { sprite->autorelease(); return sprite; } CC_SAFE_DELETE(sprite); return nullptr; }