CCSpeed* CCSpeed::create(CCActionInterval* pAction, float fSpeed) { CCSpeed *pRet = new CCSpeed(); if (pRet && pRet->initWithAction(pAction, fSpeed)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
CCSpeed * CCSpeed::actionWithAction(CCActionInterval *pAction, float fRate) { CCSpeed *pRet = new CCSpeed(); if (pRet && pRet->initWithAction(pAction, fRate)) { pRet->autorelease(); return pRet; } CCX_SAFE_DELETE(pRet) return NULL; }
CCObject *CCSpeed::copyWithZone(CCZone *pZone) { CCZone* pNewZone = NULL; CCSpeed* pRet = NULL; if(pZone && pZone->m_pCopyObject) //in case of being called at sub class 子类调用 { pRet = (CCSpeed*)(pZone->m_pCopyObject); } else { pRet = new CCSpeed(); pZone = pNewZone = new CCZone(pRet); } CCAction::copyWithZone(pZone); pRet->initWithAction( (CCActionInterval*)(m_pInnerAction->copy()->autorelease()) , m_fSpeed ); CC_SAFE_DELETE(pNewZone); return pRet; }