Destroy object by position or visibility

Get help using Construct 2

Post » Thu Oct 27, 2011 11:53 pm

Hello!

I found this forum extremely useful in solving a previous issue I had so thought I'd try another...

Is it possible to destroy an object only on the condition that it is currently in view on the screen? For example, if I want to destroy an object by standing on a switch it proceeds to destroy all the other instances of that same object on the layout. I was hoping to only destroy the object currently on screen without wiping out the other ones that appear further in my level.


I have the conditions:

Is 'object1' on screen
+
'Player' is overlapping 'switch'

then for the action I chose destroy 'object1' but it destroys all instances.

I know you can give each object a unique id, but just thought it would be much easier to only destroy the object that was on screen, or I suppose an alternative way would be to destroy the object closest to the player, that would work.

Any ideas how to implement the above?

Thanks in advance for your help.

ImageImage
Mr. Green - Platform/puzzle game out now!
B
24
S
7
G
1
Posts: 222
Reputation: 3,325

Post » Fri Oct 28, 2011 12:00 am

The event you described should work (providing both conditions are in the same event). Could you post your .capx?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Fri Oct 28, 2011 12:19 am

I think I've managed to fix the destroying of the object on screen but now it seems to have had a knock-on effect where the box falls through the holder.

I've attached the file for you to see.

Please note, I'm getting the actions and things ironed out before I arrange the levels into any sort of worthwhile game so please don't judge haha

http://dl.dropbox.com/u/44025915/Help1.capx

Thanks
ImageImage
Mr. Green - Platform/puzzle game out now!
B
24
S
7
G
1
Posts: 222
Reputation: 3,325

Post » Fri Oct 28, 2011 12:22 am

Sorry, please note. If you move the player to the bottom of the screen, it's the boxes down at the bottom that fall through.

Which is even stranger as the ones at the top of the level don't?!?

So ye, before peviewing, move the character to the bottom left of the screen.

Thanks again.
ImageImage
Mr. Green - Platform/puzzle game out now!
B
24
S
7
G
1
Posts: 222
Reputation: 3,325


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, Yahoo [Bot] and 20 guests