Destroy object by position or visibility

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

  • The event you described should work (providing both conditions are in the same event). Could you post your .capx?

  • 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

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

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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