How do I destroy only one instance of an object?

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello everyone!

    As the subject says, I want to destroy only one instance of an object and not all of them on the screen. How can i do?

    For example, on collision, I want to destroy the object that collide, but all the objects of that kind are destroyed instead.

    I wish you can help me!

    Thanks!!!

  • Hi.

    You simply say OBJECT on collision with PLAYER >> spawn your explosion, add your score, then OBJECT destroy

    and that should destroy only the object that collided

    Another tip that you might need, there is a SYSTEM select random instance which is useful to pick one out of many instances.

    Another possibility is to put a condition to OBJECT that OVERLAPS the player, which will then only apply to those specific instances which are overlapping. This is useful if you have for example a planet that has an atmosphere and if a plane flies out then it would be destroyed via NOT overlapping atmosphere.

    Good luck!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi.

    You simply say OBJECT on collision with PLAYER >> spawn your explosion, add your score, then OBJECT destroy

    and that should destroy only the object that collided

    Another tip that you might need, there is a SYSTEM select random instance which is useful to pick one out of many instances.

    Another possibility is to put a condition to OBJECT that OVERLAPS the player, which will then only apply to those specific instances which are overlapping. This is useful if you have for example a planet that has an atmosphere and if a plane flies out then it would be destroyed via NOT overlapping atmosphere.

    Good luck!

    Thanks!!!!!!!

  • > Hi.

    >

    > You simply say OBJECT on collision with PLAYER >> spawn your explosion, add your score, then OBJECT destroy

    > and that should destroy only the object that collided

    >

    > Another tip that you might need, there is a SYSTEM select random instance which is useful to pick one out of many instances.

    >

    > Another possibility is to put a condition to OBJECT that OVERLAPS the player, which will then only apply to those specific instances which are overlapping. This is useful if you have for example a planet that has an atmosphere and if a plane flies out then it would be destroyed via NOT overlapping atmosphere.

    >

    > Good luck!

    >

    Thanks!!!!!!!

    My pleasure

  • when using multiple enemies you can also use instance variables to give each instance of an object its own unique health value, sort of like in mariokart how you have battle mode w the 3 balloons, each player doesnt die until hit 3 times.

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