📄 supercenter.cpp
字号:
#include <airobot/cpp/SimpleRobot.hpp>
/**
* 这是一个向战场中心点运动的
* @author tts
*/
class SuperCenter : public SimpleRobot
{
public:
///////////////////////////////////////////////////////////////
//正确的实现方案
void onTick(TickAction* action)
{
double halfWidth = getCourtWidth()/2; //计算场地中心宽
double halfHeigth = getCourtHeight()/2; //计算场地中心高
//计算中心点坐标,并转为二维空间点
Point2D center = new Point2D.Double(halfWidth,halfHeigth);
moveTo(center);
}
//启动机器人程序
int main(int argC, char* argV[])
{
Robot* robot = new Walls();
return startup(argC, argV, robot);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -