home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 51
/
PCGamer51_17Demos.iso
/
games
/
colobotdemo
/
colobotdemo10e.exe
/
script
/
ant01.txt
next >
Wrap
Text File
|
2001-06-10
|
1KB
|
54 lines
extern void object::Attack( )
{
object p;
float dist, prox;
point nav1, nav2, dest;
boolean advance = true;
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
while ( true )
{
p = radar(WingedShooter, 0, 360, 0, 50);
if ( p == null )
{
nav1.x = position.x-5;
nav1.y = position.y;
nav2.x = position.x+5;
nav2.y = position.y;
while ( true )
{
goto(nav1);
p = radar(WingedShooter, 0, 360, 0, 50);
if ( p != null ) break;
goto(nav2);
p = radar(WingedShooter, 0, 360, 0, 50);
if ( p != null ) break;
}
}
else
{
dist = distance(p.position, position);
if ( dist <= 40 && !advance )
{
fire(p.position);
advance = true;
}
else
{
prox = dist-5;
if ( prox > 40 ) prox = 40;
if ( prox < 5 ) prox = 5;
dest.x = (position.x-p.position.x)*prox/dist + p.position.x;
dest.y = (position.y-p.position.y)*prox/dist + p.position.y;
dest.z = (position.z-p.position.z)*prox/dist + p.position.z;
goto(dest);
advance = false;
}
}
}
}