How do I spawn item only on one reference?

Get help using Construct 2

Post » Wed Aug 03, 2016 3:55 pm

I have a circle and when I click it, a square appears.
When I click the square the circle should be destroyed.
There are two circles on the screen.
When I click the square, BOTH circles get destroyed.
I want only the circle that spawned the square to be destroyed.
How to do this?
Last edited by GSquadron on Wed Aug 03, 2016 4:14 pm, edited 1 time in total.
B
25
S
7
G
1
Posts: 200
Reputation: 2,530

Post » Wed Aug 03, 2016 4:06 pm

Save the uid of the circle in a variable of the squares.
On click of the square compare its variable= circle uid, circle destroy
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Wed Aug 03, 2016 4:22 pm

I did this and it destroyed both circles again.
Image

I found out that this destroyed all circles if the square is spawned from the circle that has the lowest UID.
Otherwise, nothing happens if it is spawned from other towers and clicked.
B
25
S
7
G
1
Posts: 200
Reputation: 2,530

Post » Wed Aug 03, 2016 5:49 pm

I tried several different things and nothing seems to work.
But what really did surprise me, was that this doesn't do anything at all:
(Notice I changed it to ID for the circle too, but doesn't change anything)
Image
B
25
S
7
G
1
Posts: 200
Reputation: 2,530

Post » Wed Aug 03, 2016 6:08 pm

Man, this was so stupid. I can't believe this was the solution:
Image

If someone can explain why this worked, it would be appreciated.
Anyway, this was bothering me on other games, so it would certainly help others.
B
25
S
7
G
1
Posts: 200
Reputation: 2,530

Post » Wed Aug 03, 2016 8:59 pm

System compare does not pick the instance.
You want to use things that do pick like compare uid, or compare variable.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216


Return to How do I....?

Who is online

Users browsing this forum: biasaur, Unconnected and 9 guests