#side Fly Swat w/Eater Throws grenades, and uses a force field to make the target come to the grenade. We thought of this idea long before the game was implemented. #author Warren #color aaf #type Fly Swatter #color 946 #hardware processor 12 constructor 0.4 energy 150 0 ;c 15 solar-cells 0.2 ;c armor 150 robot-sensor 25 grenades 50 25 80 force-field .34 17 food-sensor 17 eater 0.4 ;c 40 #code #var shot-arrive-time 0 #var target-x #var target-y #var start-food-move-time -10000 #var food-x #var food-y #const food-move-interval 150 #const food-move-distance 1.00 do 1 constructor-type! energy max-energy 20 - < 0 constructor-max-rate ifev constructor-rate! time robot-sensor-time 50 + < grenades-cooldown or nif fire-robot-sensor sync robot-found if robot-velocity robot-distance 2 max grenades-speed / .75 * vs* robot-position v+ 2dup target-y! target-x! position v- rect-to-polar fire-grenade time robot-distance grenades-speed / + shot-arrive-time! then else sync then time shot-arrive-time 5 - < robot-velocity norm and robot-distance force-field-range < and if target-x target-y position v- robot-velocity shot-arrive-time time - -.75 * vs* v+ rect-to-polar force-field-direction! force-field-distance! force-field-max-power force-field-power! else id 1 - 3 / dup floor - energy max-energy 17 - > or nif time food-sensor-time 180 + > energy 75 > and if 12 food-sensor-focus-distance! random-angle food-sensor-focus-direction! fire-food-sensor sync food-found if food-distance 0 5 random > if food-position food-y! food-x! time start-food-move-time! then then then ;time to fire food sensor? food-x food-y position v- norm radius 1.05 * < if -10000 start-food-move-time! ;stop moving it it is close enough then food-found start-food-move-time time food-move-interval - > and energy 5 > and if food-x food-y position v- 2dup norm dup food-move-distance - radius max swap / vs* 2dup position v+ food-y! food-x! rect-to-polar force-field-direction! force-field-distance! force-field-max-power force-field-power! else 0 force-field-power! then else 0 force-field-power! then then forever #end