Пример #1
0
BaseBlock * BaseBlock::create(std::string fileNameStr, float attack, std::string m_name, Vec2 blockPos) {
    BaseBlock * block = new BaseBlock();
    if (block && block->init(fileNameStr, attack, m_name, blockPos))
    {
        block->autorelease();
        return block;
    }
    CC_SAFE_DELETE(block);
    return nullptr;
}
Пример #2
0
BaseBlock * BaseBlock::create(BlockType type, cocos2d::Vec2 position)
{
    BaseBlock * baseblock = new (std::nothrow) BaseBlock();
    if (baseblock && baseblock->init(type,position)) {
        baseblock->autorelease();
        return baseblock;
    }
    CC_SAFE_DELETE(baseblock);
    return nullptr;
}