# [SOLVED] Create a tower defense

### » Sat Jan 14, 2012 5:02 pm

Hi, it's my first time I post in this forum. I don't know if it's here, sorry if not. I'm french so sorry if I do something wrong. ^^
I tried to create a tower but i have a problem : I created a tower that shoot an enemy, but if he's fast, the bullet don't touch him.
My question is : How to do the bullet follow the ennemy ?
I searched tower defense tutorial, but nothing helped me.

Thank you.The_Lord_King2012-01-14 17:30:32
B
7
S
1
G
1
Posts: 20
Reputation: 807

### » Sat Jan 14, 2012 5:06 pm

You can store the UID of the enemy as a variable in the bullet, then aim the bullet at the enemy with the right UID.
Moderator
B
96
S
34
G
33
Posts: 3,007
Reputation: 27,921

### » Sat Jan 14, 2012 5:13 pm

Thank you ! You are fast and great ! ^^
So i put the UID in the bullet. I have to rotate toward position ?

And how i get the position of the target ? (i have his UID in the bullet)
B
7
S
1
G
1
Posts: 20
Reputation: 807

### » Sat Jan 14, 2012 5:20 pm

for each bullet
enemy: is UID equal to bullet('uid')
- set angle of bullet to position: enemy.x, enemy.yArima2012-01-14 17:20:50
Moderator
B
96
S
34
G
33
Posts: 3,007
Reputation: 27,921

### » Sat Jan 14, 2012 5:27 pm

It works ! Thank you very much ! You're awesome ! :D

(There is somewhere to put the topic to solved ?)
B
7
S
1
G
1
Posts: 20
Reputation: 807

### » Sat Jan 14, 2012 5:28 pm

Thanks, no prob. :)

As for a place to put the topic, not really - you can just edit the title if you want.Arima2012-01-14 17:29:21
Moderator
B
96
S
34
G
33
Posts: 3,007
Reputation: 27,921