NPC Name with movement

Hello!

Please, help me!

I have an NPC (sprite with animations) and his name (Text) above the npc.
I want the text above the NPC’s head to move with the NPC when it moves.
I think I should somehow connect the 2 objects (NPC and Text) and fix them to each other, but I don’t know how…?

This is for linking health bars but same logic works for linking anything

What you see here is 1st event we check if object in enemies group is NOT linked to healthbar
And if so we create healthbar for it and link it with that enemy
So there is no way any enemy will be without health bar or any1 will have more than 1

In 2nd event we check if health bar is linked to enemy and if so in action we change position of health bar to enemy position we want
And width of bar to hp variable of enemy AND this would be you setting text of text object to variable of your object

Where everywhere where i wrote healthbar you should read text object

1 Like

Hi!

Honestly, I didn’t quite understand what you wrote. Maybe because of my poor English. But I watched a few youtube videos and I managed to do it. Very similar to your code, so thank you very much for your help. It worked. Thanks again! :slight_smile:

1 Like

This extension can help:
https://wiki.gdevelop.io/gdevelop5/extensions/sticker/

1 Like

Hi!

Thank you very much! :slight_smile: