I'm trying to help you Outcast but even though I read every post I'm still kinda confused as to what you are trying to do in the latest mfa you posted.
Please help me to help you. :P




I'm trying to help you Outcast but even though I read every post I'm still kinda confused as to what you are trying to do in the latest mfa you posted.
Please help me to help you. :P
Haha sorry.. Think of the blue and red squares in the mfa as characters walking to the left. They each get a hat on their head on start of frame. All i want to do basically is to make this work so they have their hat. If they are destroyed their hat should also dissapear. And if a new character is created he should get a new hat on his head.
I have tried both these auto match solution with ID:s and fastloop, but I can still not get it to work properly.. What happens is that the characters switch hats with each other when a new character is created or hats stop to move and so on when a character is destroyed.. :/




test.mfa
So here's one way to solve it. It's probably not the best way, but it works well and it's how I've done it in my current project.
Here's what I changed:
*Added an "always: spread value" event to the two objects in the group. Probably not the most efficient way of doing it but it works...
*Instead of keeping the ID of the parent object I changed it to the fixed value. It's safer to do this as when when spreading values will screw up the "link" between parent and child.
*Set the ID of newly created characters to the total number of characters in the group instead of using global value A.
*When destroying an object the hat with the same fixed is destroy right away instead of in another event.
I hope that may be of some use to you!




Pretty proud of the penguins but the hats doesn't look as good as I wanted them to though... :P
Hope it helps!
It looks really goodI forgot one thing though, that I still have problem with, if you click on a blue penguin it should be destroyed and a red one should be created in its place (so it looks like they change color), but the hat should not change. I tried to carry over the ID of the blue to the red before it is destroyed but that does not seem to work?




Try this:
*User clicks with left button on "Penguin Blue"
+ID of "Hat" = Fixed("Penguin Blue")
-> Create "Penguin Red" at (0, 0) from "Penguin Blue"
-> Set ID of "Hat" to Fixed("Penguin Red")
-> Destroy "Penguin Blue"




Excellent, glad to help!