ramfire.c

来自「偶然收集到的一个C语言源码」· C语言 代码 · 共 31 行

C
31
字号
#include <airobot/c/SimpleRobot.h>

/**
 * 每个单位时间都会触发
 */
void onTick(struct TickAction* action)
{
	struct Bot* opponent = getFirstOpponent();
	if(opponent==NULL) return;
	moveTo(opponent->x, opponent->y);
}
/**
 * 当撞到其它机器人时触发
 */
void onHitRobot(struct HitRobotAction* action)
{
	struct Bot* hited = getBotById(action->hited);
	fireOnPoint(hited->x, hited->y, 2);
}

/**
 * 机器人程序入口
 */
int main(int argC, char* argV[])
{
	tickHook = onTick;
	hitRobotHook = onHitRobot;	
	return startup(argC, argV);
}

																	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?