Vec2 VectorPoint = (movePoint - startPoint).getNormalized();
//判断在第几象限
if(VectorPoint.y > 0 && VectorPoint.y < 1)
{
//第一象限
if(VectorPoint.x > 0 && VectorPoint.x < 1 )
{
//获取移动位置
Vec2 moveDistance = Vec2(startX + moveSpeed,startY + moveSpeed);
}
else if(VectorPoint.x < 0 && VectorPoint.x > -1) //第二象限
{
}
}
else if(VectorPoint.y < 0 && VectorPoint.y > -1)
{
//第三象限
if(VectorPoint.x > -1 && VectorPoint.x < 0)
{
}
else if(VectorPoint.x > 0 && VectorPoint.x < 1) //第四象限
{
}
}
获取精灵在第几象限(以某个精灵为准)
最新推荐文章于 2021-12-14 18:51:07 发布