コード例 #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
ファイル: creatures.cpp プロジェクト: arthur-hav/QuickRL
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
}