home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 51
/
PCGamer51_17Demos.iso
/
games
/
colobotdemo
/
colobotdemo10e.exe
/
script
/
tfollow1.txt
< prev
next >
Wrap
Text File
|
2001-06-10
|
529b
|
34 lines
extern void object::Solution( )
{
while ( true )
{
object target;
float dir, len;
target = radar(TargetBot);
if ( target == null )
{
motor(0, 0); // stoppe
break;
}
len = distance(position, target.position);
if ( len < 5 ) // trop proche ?
{
motor(len/5-1, len/5-1); // recule
}
else
{
dir = direction(target.position);
if ( dir < 0 ) // α droite ?
{
motor(1, 1+dir/90);
}
else // α gauche ?
{
motor(1-dir/90, 1);
}
}
}
}