How do I spawn item only on one reference?

  • 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?

  • Save the uid of the circle in a variable of the squares.

    On click of the square compare its variable= circle uid, circle destroy

  • I did this and it destroyed both circles again.

    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.

  • 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)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Man, this was so stupid. I can't believe this was the solution:

    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.

  • System compare does not pick the instance.

    You want to use things that do pick like compare uid, or compare variable.

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