Help with Tracking (.blend included)

I’m creating a video game where the human race has been pitted against foreign aliens. With a strong desire to clean the system from intergalactic contaminants, the aliens have decided to wipe out all traces of foreign machinery and life. The government has assigned you along with specifically choosen citizens enrolled in the military to protect the system and bring peace to the two races.

Unfortunatly at the moment though, this shouldn’t be all that difficult since the enemies as well as your allies are too stupid to chase each other. Here’s the problem:

The enemy ships and your allies are supposed to track to each other whenever they get near one another but instead, they chase the enemy and ally ships on the hidden layer.

I’ve attached a Blender file which contains what I have created so far. Just play the game when you open it up and it’ll explain the problem in greater detail. Please note though, that I would greatly appreciate it if you did not take the textures included with the .blend file without consent from me. You may use the game logic though.

Glider Game.blend

You will have to remap the object “ally”.
Map for Object “Ally”

GAME CONTROLS:
W key = forward
A key = turn left
D key = turn right
S key = back up
F key = tells any allies near you to follow you if they aren’t too busy
SPACE = shoot
Shift, B, O, M = stops any enemies near you (cheat)

PS: Good concept isn’t it? All comments are welcome. Also, If anyone is interested, send me a message if you would like to join in the creation of this game and we will see if we can get something together.

This was asked very often the last few days.

You set the trackTo actuator with the name of the enemy. This means the actuator track to the enemy on the hidden layer as it does not know anything else. (There is no other object called “enemy”).
You need a python script to change the trackTo actuators’s object to be the near sensor’s hitObject when activating near.

The same belongs to the ally object.

I hope it helps

Alright, I’ll give it a try. I’ll tell you how it turns out. Thanks!

It worked! Thanks!