예제 #1
0
파일: MCL.c 프로젝트: xdanx/dandroid
void move_forward(int power, float distance) {
	robotState = MOVE_STATE;

	motor[LEFT_WHEEL] = power;
	motor[RIGHT_WHEEL] = power;
	float time = get_move_time(power, distance);
	wait1Msec(time);
	stop();
}
예제 #2
0
unsigned int CMob::think()
{
    int losx = x;
    int losy = y;
    if(los(losx, losy, PC->x, PC->y, get_fov_rad()))
    {
        last_seen_x = PC->x;
        last_seen_y = PC->y;
        chasing = true;
    }
    if (chasing)
    {
        if(tryattack(last_seen_x - x, last_seen_y - y))
            return get_attack_time();
        if(step_to(last_seen_x, last_seen_y))
            return get_move_time();
    }
    return get_move_time(); //idle
}