[Solved] Having Problems with Object Linking

What is the expected result

For each shadow, background hp bar and hp bar to follow its linked object and its properties

What is the actual result

They don’t even even follow their supposed events, they just stay in a single place

And also another strange behaviors, like when I kill one of the 3 slimes:

Related screenshots

Any help is appreciated, thank you!

I think linking order may have an affect. Try Link [object] to slime, where object is slimeShadow, enemyHpBar and enemyHp.

Alternatively, if slime doesn’t rotate, consider the Sticker extension. You place the objects relative to the slime object, and then stick the objects to the slime. No need to reposition when the slime moves, the extension does all that for you.

1 Like

Thank you for the suggestion!
But it wouldn’t work exactly, as I want the enemyHp to change its width according to the slime’s hp too, not just position
I tried changing the order, and nothing changed

You can change the enemyHp width and reposition it if needed. It’ll stay stuck to the slime.

1 Like

Yes, but that’s the problem, because it doesn’t show the slime’s health, because the width doesn’t change
Only the first instance of the slime (the one on the left) works perfectly for some reason

Ok, then add a unique id to both the slime and the HP bar (same id value for te bar and slime). Or link those two, for the purpose of updating the width.

Can you post a screen snip of the events?

Like this?

You don’t need the always; an unconditional event is always actioned.

Replace the Always event with a For Each Slime. Because the current problem you have is that there are no conditions that specify which slime the linked objects belong to. So GDevelop will just take the first one on it’s list.

1 Like