How do I Select an Object That is Pinned?

0 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hey there,

    I have monsters in my game that have name tags above their heads. When a monster is destroyed I would also like to destroy the corresponding name tag. Currently I am using a textbox and pinning it to the monster. Unfortunately, I haven't figured out how to select pinned objects to destroy them. Any help on this one?

    Thank You,

    Stephen

  • Hey ,

    You need use container. Go in the properties of your sprite , look for "container" and add your text object.

    Now when you destroy your sprite , all objects in the container is destroyed too.

  • When an object is pinned, you can get the UID of the object it is pinned to using the PinnedUID expression.

    So when you want to destroy a monster, before destroying it, pick textbox by UID where the UID is equal to monster.Pin.PinnedUID. Destroy the textbox, then you can destroy the moster

  • Alright, I'll look into containers and Pinned UIDs. I'll let y'all know if I get it working.

    vioz and OlivierC

    Edit:

    Okay, containers are working for me. But now the name plates are not reflecting the monster they are above. I am assuming this is because if I change one textbox the rest of them change as well. Is there a way to change each textbox and not effect the other ones?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Finally got it to work. I had to remove the containers to keep the name plates working. Here's the code I used.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)