cocos2d-x头像跟着轨迹移动关键代码

与kexinmei共同完成此文章

void RotateWithAction::step( float dt )
{
	CCPoint prePos=pInnerTarget->getPosition();
	pInnerAction->step(dt);
	CCPoint curPos=pInnerTarget->getPosition();

	float degree=atan2((curPos.x-prePos.x),(curPos.y-prePos.y));
	degree=degree/3.14159f*180;

	pInnerTarget->setRotation(degree);
}


你可能感兴趣的:(cocos2d-x头像跟着轨迹移动关键代码)