How do I delete an instance of a newly created Object?

0 favourites
  • 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I create a new object with the "CreateObject" script. I then add many more so I have a multitude of instances of that same object. I want to click on an instance and have it "destroyed", but now it destroys all of the instances. How do I only destroy the instance that I click on and not all of the others?

    Tagged:

  • You would need to "pick" the correct instance with a condition.

    Normally this should already be done with the object on clicked condition, so that any actions in that event such as destroy are applied only to the instance that was clicked.

  • Not sure what that means... is there some type of "self" tag (i.e. card.self destroy) The condition is a simple "when I click on the instance"...

    Currently i have:

    OnLeftBut Clicked object (card) --> Destroy card (see below)

  • So you're picking the tab close object, but there are no cards picked in the condition, so destroying a card will destroy all of them. You can add the 'mouse -cursor is over object' condition to pick the correct card.

    Otherwise, you'll have to associate the tab close object with the card it belongs to somehow. A container could be good for this. Then they will always created, picked, and destroyed together as a pair.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Money! Both solutions work. TY

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