Example #1
0
CCPoint Character::getPositionInWorld()
{
    CCPoint pos;
    if(m_bodyArray.size() == 0)
        return pos;
    b2Body* pBody = m_bodyArray[0];
    if(!pBody)
        return pos;
    CCSprite* pSprite =  (CCSprite*)pBody->GetUserData();
    if(!pSprite)
        return pos;
    CCNode* pParent = pSprite->getParent();
    if(!pParent)
        return pos;
    pos = pSprite->convertToWorldSpace(pSprite->getPosition());
    return pos ;
}