home *** CD-ROM | disk | FTP | other *** search
- { ****** TRIGGER ******}
- { This robot wanders around in a random direction (increments of 45'),
- { like AIMLESS, but when it finds a tank, it attempts to lock on. }
-
-
- REPEAT
-
- {** Pick a random starting direction **}
- a=rnd(8)
- a:=a*45
- SHIELD OFF
- RADAR(a)
-
- {** Have we found a tank **}
- IF object=tank THEN
-
- TURRET(a) {** Yes, so turn to face it **}
-
- {** While we can still see the tank **}
- REPEAT
- RADAR gunheading {** Check the tank is still there **}
- IF object=tank THEN {** IF the tank is in the sights ....**}
- {** Only FIRE at it IF it's further away than the explsosion radius, otherwise FIRE just beyond it **}
- IF distance>explode THEN
- FIRE distance
- ELSE
- FIRE explode+5
- ENDIF
-
- ELSE
- {** Damn, lost the tank, so sheck 5' clockwise to see IF it's there **}
- RADAR(gunheading+5)
- {** IF it's there THEN blast it again **}
- IF object=tank THEN
- TURRET gunheading+5
- IF distance>explode THEN
- FIRE distance
- ELSE
- FIRE explode+5
- ENDIF
-
- ELSE
-
- {** Damn, still not there so try 5' anticlockwise **}
- RADAR(gunheading+355)
- {** IF it's there than blast it yet again **}
- IF object=tank THEN
- TURRET gunheading+355
- IF distance>explode THEN
- FIRE distance
- ELSE
- FIRE explode+5
- ENDIF
- ENDIF
-
- ENDIF
-
- ENDIF
-
- UNTIL object<>tank
-
- ELSE
- {** We didn't spot a tank, what about a missile **}
- IF object=missile THEN
- DO 10
- SHIELD ON {** OHMYGOSH...Shiled on for while **}
- LOOP
- ENDIF
- ENDIF
-
- {** It wasn't a tank so turn towards it and charge **}
- ROTATE(a)
- MOVE(distance-20)
-
- FOREVER
-