How do I : Destroy Objects to open door

Get help using Construct 2

Post » Mon Jun 01, 2015 3:06 am

Hello,

I'm trying to make it so that the door destroys when the LAST PILLAR on screen is destroyed?

I've tried things such as
(INVERT)pillar is on screen destroy
(INVERT)pillar is overlapping (Pillar checking sprite)

Image
B
17
S
3
Posts: 37
Reputation: 935

Post » Mon Jun 01, 2015 6:48 am

You could make a global variable for the number of pillars on screen and when it equals 0 or less the gate opens/destroys.

I did something similar with random enemies on screen. I made it spawn a random amount so i never knew how many would be there. The way I made it all work out is I just had the on start event add 1 for every enemy, then I made the door open when the number of enemies was 0.

I'll try to make a quick demo for you, hope this helps.
B
12
S
4
G
2
Posts: 132
Reputation: 1,749

Post » Mon Jun 01, 2015 7:11 am

Try this.
When the pillars are created they add 1 to the global variable pillars. When this variable hits 0, the gate destroys.
https://www.dropbox.com/s/b3xjxp1urf8ul ... .capx?dl=0
B
12
S
4
G
2
Posts: 132
Reputation: 1,749

Post » Mon Jun 01, 2015 8:19 am

If by "on screen" you mean on the layout there is a global value for the number of pillars ; Pillars.count
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Mon Jun 01, 2015 11:44 am

Many thanks for the help all <3
B
17
S
3
Posts: 37
Reputation: 935



Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo and 23 guests