How do I Destroy a specific object?

Get help using Construct 2

Post » Thu Nov 24, 2016 8:12 pm

Hello there!

In my game, I have 3 "pairs" of objects. What I would like to do, is when a object is destroyed a specific other object also gets destroyed. So:

Object A - Object1
Object B - Object2
Object C - Object3

When object A is destroyed, Object1 gets automatically destroyed. The same for Object B and 2 etc. How would I achieve this? Should I set an instance variable on Objects A, B, C with the UID of Objects 1,2,3, and then..?

I hope I make sense :)
B
7
S
1
Posts: 23
Reputation: 421

Post » Thu Nov 24, 2016 8:16 pm

That is one way. Another is to use a Container.
https://www.scirra.com/manual/150/containers
ImageImageImage
B
71
S
21
G
230
Posts: 3,688
Reputation: 128,847

Post » Thu Nov 24, 2016 8:28 pm

Wow, that was fast! I will look into the container option. However, just for curiosity: how can I achieve the same effect with the instance variables?
B
7
S
1
Posts: 23
Reputation: 421

Post » Thu Nov 24, 2016 9:03 pm

Assuming you create the two together (which Containers do too), just store the UID of one on the other, and then when you need it, Pick by UID.
ImageImageImage
B
71
S
21
G
230
Posts: 3,688
Reputation: 128,847


Return to How do I....?

Who is online

Users browsing this forum: plinkie and 32 guests