home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / colobotdemo / colobotdemo10e.exe / script / spider01.txt < prev    next >
Text File  |  2001-06-10  |  1KB  |  64 lines

  1. extern void object::Attack( )
  2. {
  3.     int        enemy;
  4.     object    p;
  5.     float    dist;
  6.     point    nav1, nav2, nav3, nav4, dest;
  7.  
  8.     errmode(0);  // ne stoppe pas si erreur
  9.     while ( ismovie() != 0 )  wait(1);
  10.  
  11. //    enemy = WheeledGrabber;
  12.     enemy = WingedOrgaShooter;
  13.  
  14.     while ( true )
  15.     {
  16.         p = radar(enemy, 0, 360, 0, 50);
  17.         if ( p == null )
  18.         {
  19.             nav1.x = position.x+2.5;
  20.             nav1.y = position.y+2.5;
  21.             nav2.x = position.x+2.5;
  22.             nav2.y = position.y-2.5;
  23.             nav3.x = position.x-2.5;
  24.             nav3.y = position.y-2.5;
  25.             nav4.x = position.x-2.5;
  26.             nav4.y = position.y+2.5;
  27.  
  28.             while ( true )
  29.             {
  30.                 goto(nav1);
  31.                 p = radar(enemy, 0, 360, 0, 50);
  32.                 if ( p != null )  break;
  33.  
  34.                 goto(nav2);
  35.                 p = radar(enemy, 0, 360, 0, 50);
  36.                 if ( p != null )  break;
  37.  
  38.                 goto(nav3);
  39.                 p = radar(enemy, 0, 360, 0, 50);
  40.                 if ( p != null )  break;
  41.  
  42.                 goto(nav4);
  43.                 p = radar(enemy, 0, 360, 0, 50);
  44.                 if ( p != null )  break;
  45.             }
  46.         }
  47.         else
  48.         {
  49.             dist = distance(p.position, position);
  50.             if ( dist <= 7.5 )
  51.             {
  52.                 fire();
  53.             }
  54.             else
  55.             {
  56.                 dest.x = (position.x+p.position.x)/2;
  57.                 dest.y = (position.y+p.position.y)/2;
  58.                 dest.z = (position.z+p.position.z)/2;
  59.                 goto(dest);
  60.             }
  61.         }
  62.     }
  63. }
  64.