Lock on Target!

Hello everyone!
I have a rather difficult task for the strong minds!
For my game I have an actor spawned randomly (called Enemy), and it passes through the screen from the right to the left.
What I want to do is when the player touches the spawned actor,a target icon is spawned on top (following the actor "Enemy") and then a homing missile is spawned to destroy the specified actor.
I tried the following:
------------------
Create a Boolean attribute called "EnemyLifeSpawn"
Create a real attribute called "FollowX"
Create a real attribute called "FollowY"
IN ACTOR "ENEMY":
RULE 1:
When enemy is touched - Change attribute "EnemyLifeSpawn" to true
Spawn Actor "target" On top layer from the actor
RULE 2:
When EnemyLifeSpawn is true:
Constrain attribute FollowX to positionX
Constrain attribute FollowY to positionY
IN ACTOR "TARGET"
Constrain attribute positionX to FollowX
Constrain attribute positionY to FollowY
RULE 1:
When EnemyLifeSpawn is false - Destroy the actor
------------------
Believe it or not, when I touch on the Enemy the system goes haywire!
Sometimes it selects the actor that is coming (not the actor that I am touching,but the next one!
Sometimes the actor target stays stationery
Sometimes the actor target gets destroyed in half a second
ANY IDEAS????
I have a rather difficult task for the strong minds!
For my game I have an actor spawned randomly (called Enemy), and it passes through the screen from the right to the left.
What I want to do is when the player touches the spawned actor,a target icon is spawned on top (following the actor "Enemy") and then a homing missile is spawned to destroy the specified actor.
I tried the following:
------------------
Create a Boolean attribute called "EnemyLifeSpawn"
Create a real attribute called "FollowX"
Create a real attribute called "FollowY"
IN ACTOR "ENEMY":
RULE 1:
When enemy is touched - Change attribute "EnemyLifeSpawn" to true
Spawn Actor "target" On top layer from the actor
RULE 2:
When EnemyLifeSpawn is true:
Constrain attribute FollowX to positionX
Constrain attribute FollowY to positionY
IN ACTOR "TARGET"
Constrain attribute positionX to FollowX
Constrain attribute positionY to FollowY
RULE 1:
When EnemyLifeSpawn is false - Destroy the actor
------------------
Believe it or not, when I touch on the Enemy the system goes haywire!
Sometimes it selects the actor that is coming (not the actor that I am touching,but the next one!
Sometimes the actor target stays stationery
Sometimes the actor target gets destroyed in half a second
ANY IDEAS????
Comments
Any new objects of that proto wouldnt interfere cause they are set not to output the X,Y unless they are clicked.
So only one of that prototype is designating the position.
And then the target thing follows it. At least, that's if Im reading it right.
However, I don't think thomas12343 has that challenge. He simply wanted to have a target stuck on top of the actor (and did not mention anything about animations). Why not just change the actor's image? He can take under 10 minutes to copy and paste the target on top of the artwork (in a graphics editor), or he can spend 10 hours locked in a battle of logic with GS. (Really the logic battle resides within us -- GameSalad is simply following the rules and behaviors we give it.)