Genetics‎ > ‎Gene Types‎ > ‎

if_distance Gene

The if_distance gene allows MyKaryotes to switch genes on or off depending on how close they are to something else.

The syntax is exactly the same as that for the if_attribute_real gene, with the following differences.

The first argument is the type of object whose distance will be checked. This is a string with the following possible values:
  • nearest_prey
  • nearest_predator
  • nearest_same_species
  • nearest_wall
  • nearest_cell
Note that the search will only include objects within the MyKaryote's range of vision. If no matching objects are found, then this gene does nothing.

The third argument is still a real value to compare against, except that here it is specifically a distance measured in pixels. For reference, the walls in MyKaryotes are about 16 pixels wide when viewed without zoom.

All other arguments are exactly the same as those for the if_attribute_real gene.