📄 oldchase.txt
字号:
void CChaseAction::Go_Behind_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x - distx;
offset.y = env->currentBall.pos.y;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
void CChaseAction::Go_Above_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x;
offset.y = env->currentBall.pos.y + disty;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
void CChaseAction::Go_Below_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x;
offset.y = env->currentBall.pos.y - disty;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
void CChaseAction::Go_Front_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x + distx;
offset.y = env->currentBall.pos.y;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
void CChaseAction::Go_AboveNBehind_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x - distx;
offset.y = env->currentBall.pos.y + disty;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
void CChaseAction::Go_BelowNBehind_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x - distx;
offset.y = env->currentBall.pos.y - disty;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
void CChaseAction::Go_AboveNFront_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x + distx;
offset.y = env->currentBall.pos.y + disty;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
void CChaseAction::Go_BelowNFront_Pos(Vector3D Destination,Robot *robot,int WhichRobot,int distx,int disty)
{
Vector3D offset;
offset.x = env->currentBall.pos.x + distx;
offset.y = env->currentBall.pos.y - disty;
if(offset.x < 0){offset.x = 0;}
if(robot->pos.x >= (offset.x + 7) && robot->pos.x <= (offset.x - 7) && robot->pos.y >= (offset.y + 7) && robot->pos.y <= (offset.y - 7) )
{
robot->velocityLeft = 0;
robot->velocityRight = 0;
}
else
{
Position_Myro(offset,WhichRobot);
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -