Hello again.
I just need help with one more thing. I have a game where objects are created randomly, along with name tags (which are created 50 pixels above the objects). Then, the objects travel in a certain direction. The name tags travel in the same direction at the same speed.
This creates the illusion that these objects are linked, but they aren’t really linked, they just travel in a way that looks like that. And therein lies my problem.
When the main object, which is a tank, is destroyed, I have no good way of destroying the text along with it. I tried to “select the name tag nearest to the tank that was destroyed and destroy that”, but this does not work all of the time! For some reason, every 1/40 tanks will have their name tags continue towards the player after they die, which is weird.
I did a lot of testing, and I think this happens when a.) two tanks are destroyed at the same time, or b.) two tanks are very close and one is destroyed before the other.
Also, you should know that the tanks come from all directions towards the player.
I think the solution is to make the name an object of the tank when they are formed, but I have no idea how to do this? Any suggestions? Thanks!