Follow* Follow::create(Node *followedNode, const Rect& rect/* = Rect::ZERO*/)
{
    Follow *follow = new (std::nothrow) Follow();
    if (follow && follow->initWithTarget(followedNode, rect))
    {
        follow->autorelease();
        return follow;
    }
    CC_SAFE_DELETE(follow);
    return nullptr;
}
Esempio n. 2
0
Follow* Follow::createWithOffset(Node* followedNode,float xOffset,float yOffset,const Rect& rect/*= Rect::ZERO*/){


    Follow *follow = new (std::nothrow) Follow();

    bool valid;

    valid = follow->initWithTargetAndOffset(followedNode, xOffset, yOffset,rect);

    if (follow && valid)
    {
        follow->autorelease();
        return follow;
    }

    delete follow;
    return nullptr;

}