void HomeWork::speedMove(float dt)
{
degress += 5;
float nexPosX = cos(CC_RADIANS_TO_DEGREES(degress)) * dist;
float nexPosY = sin(CC_RADIANS_TO_DEGREES(degress)) * dist;
enemy->setPosition( Point(nexPosX,nexPosY) + targetPoint);
float dx = enemy->getPositionX() - targetPoint.x;
float dy = enemy->getPositionY() - targetPoint.y;
float radian = atan2(dy,dx);
float deg = CC_RADIANS_TO_DEGREES(radian);
enemy->setRotation(-deg + 90);
}
物体旋转
最新推荐文章于 2023-03-29 17:50:40 发布