Пример #1
0
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;
}
Пример #2
0
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;
}