Towe defence problem

Heres a problem I’ve had for about a day.

I want to be able to have a cube be spawned by a delay and be able to make a tower by clicing on the ground. Those two things are already done. But the problem is when the cube spawns The tower shoots at the cubes position in the layer it is in before it is spawned. This is my first blend to up so idk how it is.

press 1 to select the tower and the click on the ground to make it.

Attachments

TD.blend (724 KB)

Check The trackTo actuator and object instances for an explaination.

I hope it helps

Maybe it’s just the fact that I’m using 2.48, but whenever I start it, I get the error:

File “Mouse”, line 16, in?
TypeError: iterable argument required

I don’t fully understand your script, because I’m a bit of a noob, but you should check if you’re getting that same error in your console.

Wow I dont know any python really so how could I get the object to trackto the other object when it comes within 30 units of it?

When I had no idea how to use python, I had this same problem (which in fact wasn’t long ago). Here’s a good solution for you:

Attachments

Script Example.blend (286 KB)