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

  1. extern void object::Attack( )
  2. {
  3.     int        list[], i;
  4.     object    p;
  5.     float    dist;
  6.     point    dest, center;
  7.  
  8.     errmode(0);  // ne stoppe pas si erreur
  9.     while ( ismovie() != 0 )  wait(1);
  10.  
  11.     i = 0;
  12.     list[i++] = Derrick;
  13.  
  14.     while ( true )
  15.     {
  16.         if ( load == null )  // ne porte rien ?
  17.         {
  18.             p = radar(OrgaMatter);  // cherche matiΦre
  19.             if ( p == null )
  20.             {
  21.                 jet(1);  // monte
  22.                 dest = position;
  23.                 dest.x += (rand()-0.5)*10;
  24.                 dest.y += (rand()-0.5)*10;
  25.                 goto(dest);  // va n'importe o∙
  26.                 wait(2);
  27.             }
  28.             else
  29.             {
  30.                 center = p.position;
  31.                 dest = p.position;
  32.                 dest.z = position.z;
  33.                 dist = distance(dest, position);
  34.                 if ( dist > 1.25 )
  35.                 {
  36.                     jet(1);  // monte
  37.                     goto(p.position);  // va sur la matiΦre
  38.                 }
  39.                 else
  40.                 {
  41.                     jet(-1);  // descend
  42.                     while ( altitude > 0 );
  43.                     grab();  // prend la matiΦre
  44.                 }
  45.             }
  46.         }
  47.         else  // porte matiΦre ?
  48.         {
  49.             jet(1);  // monte
  50.             p = radar(list, 0, 360, 0, 1000, 1, FilterOnlyLanding);
  51.             if ( p == null )
  52.             {
  53.                 dest = center;
  54.                 dest.x += (rand()-0.5)*100;
  55.                 dest.y += (rand()-0.5)*100;
  56.                 goto(dest, 0, 1, 0);  // va n'importe o∙
  57.             }
  58.             else
  59.             {
  60.                 dest = p.position;
  61.                 dest.z = position.z;
  62.                 dist = distance(dest, position);
  63.                 if ( dist > 1.25 )
  64.                 {
  65.                     goto(p.position);  // va sur la cible
  66.                 }
  67.                 else
  68.                 {
  69.                     drop();  // lΓche la matiΦre
  70.                 }
  71.             }
  72.         }
  73.     }
  74. }
  75.