home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / colobotdemo / colobotdemo10e.exe / script / tower1.txt < prev    next >
Text File  |  2001-06-16  |  872b  |  32 lines

  1. extern void object::ServiceTower1()
  2. {
  3.     object  tower;               // info. about tower
  4.     object  station;             // info. about station
  5.     
  6.     // 1) goes toward the defense tower
  7.     tower = radar(DefenseTower); // looks for tower
  8.     goto(tower.position);        // goes there
  9.     
  10.     while ( true )               // always repeats:
  11.     {
  12.         // 2) waits until power cell is empty
  13.         while ( tower.energyCell.energyLevel > 0.2 )
  14.         {
  15.             wait(2);
  16.         }
  17.         grab();                  // grabs the power cell
  18.         
  19.         // 3) goes toward power station to recharge
  20.         station = radar(PowerStation);
  21.         goto(station.position);  // goes there
  22.         while ( load.energyLevel < 1 )
  23.         {
  24.             wait(1);             // waits until recharged
  25.         }
  26.         
  27.         // 4) goes back to defense tower
  28.         goto(tower.position);    // goes toward tower
  29.         drop();                  // drops the power cell
  30.     }
  31. }
  32.