Move object closer to another object using python? I'm setting up a simple game loop in which the agent tries to collide with "enemies" (so they'll have the game property "enemy") and tries to steer clear of other objects (let's call them friends). I want to write a script that makes use of the near sensor to do this-so if an enemy is detected nearby, the agent moves towards it and, if they collide, the enemy is destroyed. Similarly, if the near sensor detects a friend, the agent moves away from it (to make things more interesting, maybe I can apply endobject() or something to the agent if it accidentally collides with a friend). Is there any way to programmatically get the agent to move towards/away from other objects with these specified properties?

And, for that matter, is it possible to specify these game properties programmatically? I want to avoid using the gui as much as possible. 

Thanks so much!
The near sensor has an attribute "Property". The sensor will filter the sensed objects by to have a property of the same name. 

So you are able to sense friends by giving them a property called "friend" and let the near sensor filter for "friend" too.

Do the same thing just with "enemy" to sense enemies.

To get the appropriate operation after detecting the near event you can use either the steering actuator (Flee, Seek, Path following), or you activate an TrackTo + Move forwards/backward. I'm sure there are more options.

Detecting a collision can be done via collision sensor. An object can end itself via Edit Actuator in End Object mode.