How do I destroy an object when another is placed on it?

Get help using Construct 2

Post » Mon Jun 29, 2015 4:40 pm

Hi guys, hoping there's someone who has some ideas on how to help me with this.

I'm building a game where the player can drag and drop ship components onto a grid to design their own ship, however I'm having trouble making progress with 2 aspects.

When the player drops a component on a cell of the grid where a component is already placed, how can I make it so that the original component is destroyed?

I've tried this via:

[Ship Family] "is object over lapping" [Ship Family] --> Destroy [Ship Family]

on the release of the drag and drop, however this doesn't seem to do anything.

I've also tried:

If [Ship Family].X = [Ship Family].X
and [Ship Family].Y = [Ship Family].Y
then destroy [Ship Family]

However of course, this just destroys all objects in the family.

Would I be able to achieve this through the "Pick nearest" event, and say if nearest is <X then destroy? I've no experience using this event so i'm not sure how to go about this.
Posts: 10
Reputation: 220

Post » Mon Jun 29, 2015 5:46 pm

You can make a second family with the same objects in it. Then you have a unique name to compare to.

[Ship Family] "is object over lapping" [Ship Family Tester] --> Destroy [Ship Family Tester]
Posts: 3,842
Reputation: 154,886

Post » Mon Jun 29, 2015 6:41 pm

Ah fantastic, works a charm. Thank you!
Posts: 10
Reputation: 220

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests