How do I Select an Object That is Pinned?

Get help using Construct 2

Post » Thu May 22, 2014 10:51 am

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
B
56
S
15
G
13
Posts: 826
Reputation: 17,705

Post » Thu May 22, 2014 12:21 pm

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.
B
13
S
3
G
2
Posts: 49
Reputation: 1,675

Post » Thu May 22, 2014 12:38 pm

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
B
12
S
5
G
2
Posts: 132
Reputation: 2,637

Post » Thu May 22, 2014 6:33 pm

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?
B
56
S
15
G
13
Posts: 826
Reputation: 17,705

Post » Thu May 22, 2014 8:31 pm

Finally got it to work. I had to remove the containers to keep the name plates working. Here's the code I used.
You do not have the required permissions to view the files attached to this post.
B
56
S
15
G
13
Posts: 826
Reputation: 17,705


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests