How do I delete object on collision

  • I have a button that creates ball.

    This ball fly around the screen, and whenever it hits red box it should be destroyed.

    The problem that whenever I try to destroy this object, it destroy all others objects of this kind. In other words, clicking the button creates new object of ball, thus unlimited number can be spawned, however I require to destroy only ones that come into collision with the red box.

    Could anyone help me to solve this issue?

  • If two objects collide it should only destroy one of this objects not all instances. It depends of your action which object gets destroyed.

    The event should look like:

    Ball | On collision with Box -> Box| Destory.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • try switching the event around. it likes to be tempermental sometimes.

    i.e.

    Box - On Collision With Ball- Destroy Ball

    may have a different outcome than

    Ball - On Collision With Box - Destroy Ball

    i believe the logic behind it is: If THIS box comes in contact with any ball, destroy all balls

    If THIS Ball Touches any box, Destroy THIS ball.

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