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!