#include "CircleMoveAct.h"
@H_
502_70@
CircleMoveAct* CircleMoveAct::create(
CCPoint& center,255)!important; border:0px!important; white-space:normal; margin:0px!important; outline:0px!important; text-align:left!important; float:none!important; vertical-align:baseline!important; position:static!important; left:auto!important; top:auto!important; right:auto!important; bottom:auto!important; height:auto!important; width:auto!important; line-height:1.1em!important; font-weight:normal!important; font-style:normal!important; min-height:inherit!important">angle)
@H_
502_70@
CircleMoveAct *pRet =
new
CircleMoveAct();
@H_
502_70@
pRet->initWithDuration(duration,center,scale,angle);
@H_
502_70@
pRet->autorelease();
@H_
502_70@
CircleMoveAct::initWithDuration(
angle)
@H_
502_70@
if
(CCActionInterval::initWithDuration(duration))
@H_
502_70@
this
->m_duration = duration;
@H_
502_70@
->m_center = center;
@H_
502_70@
->m_scaleDiff = scaleDiff;
@H_
502_70@
->m_currScale = 1.0f;
@H_
502_70@
->m_angle = angle;
@H_
502_70@
/* 计算每次update
调用时需要转动的弧度 */
@H_
502_70@
->m_anglePreFrame = angle / duration * CCDirector::sharedDirector()->getAnimationInterval() / (180 / M_PI);
@H_
502_70@
->m_frameCnts = 0;
@H_
502_70@
false
CCObject* CircleMoveAct::copyWithZone(CCZone *pZone)
@H_
502_70@
CCZone* pNewZone = NULL;
@H_
502_70@
CircleMoveAct* pCopy = NULL;
@H_
502_70@
if
(pZone && pZone->m_pCopyObject)
@H_
502_70@
pCopy = (CircleMoveAct*)(pZone->m_pCopyObject);
@H_
502_70@
pCopy =
CircleMoveAct();
@H_
502_70@
pZone = pNewZone =
CCZone(pCopy);
@H_
502_70@
CCActionInterval::copyWithZone(pZone);
@H_
502_70@
pCopy->initWithDuration(m_duration,m_center,m_scaleDiff,m_angle);
@H_
502_70@
CC_SAFE_DELETE(pNewZone);
@H_
502_70@
CircleMoveAct::startWithTarget(CCNode *pTarget)
@H_
502_70@
CCActionInterval::startWithTarget(pTarget);
@H_
502_70@
m_initPos = pTarget->getPosition();
@H_
502_70@
CircleMoveAct::update(
)
@H_
502_70@
m_frameCnts++;
@H_
502_70@
m_currScale += m_scaleDiff;
@H_
502_70@
CCPoint newPos = ccpRotateByAngle(m_initPos,m_frameCnts * m_anglePreFrame);
@H_
502_70@
CCPoint diff = ccpSub(newPos,m_center);
@H_
502_70@
newPos = diff * m_currScale + m_center;
@H_
502_70@
m_pTarget->setPosition(newPos);
@H_
502_70@
CCDrawNode *node = CCDrawNode::create();
@H_
502_70@
node->drawDot(newPos,3,ccc4f(128,128,128));
@H_
502_70@
m_pTarget->getParent()->addChild(node);
@H_
502_70@
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
@H_
502_70@
CCSprite *test = CCSprite::create(
"CloseNormal.png"
test->setPosition(ccp(size.width/2 + 20,size.height/2));
@H_
502_70@
test->setAnchorPoint(ccp(0.5,0.5));
@H_
502_70@
//设置用时,圆心,是否缩放(不缩放设置为0.0f),旋转角度
@H_
502_70@
CircleMoveAct *act = CircleMoveAct::create(10,ccp(size.width/2,size.height/2),0.0f,1500);
@H_
502_70@
test->runAction(act);
@H_
502_70@
->addChild(test);
@H_
502_70@