0 Favourites

How do I collide with only one object within an overlap?

  • How do I have a bullet only collide with one of two or more overlapping objects.

    So say I fire a bullet at 3 sprites that happen to be overlapping, how would I go about making it only destroy one of those sprites?

  • In general all events come the same form.

    A condition that picks objects (the basic picklist is made in the first condition)

    (in the same event, or as sub) A condition that starts picking from the basic picklist and refines

    (in the same event, or as sub) More conditions that start picking from the refined picklist and refines

    .......................... actions

    In your case.

    'Bullet' is overlapping another object 'Sprite'. (now the basic picklist contains 3 sprites)

    'Sprite' > pick top/bottom

    or

    'Bullet' is overlapping another object 'Sprite'

    system > pick random instance 'sprite'

    or

    'Bullet' is overlapping another object 'Sprite'

    system > pick nth instance 'sprite', instance = zero

    or

    'Bullet' is overlapping another object 'Sprite'

    Sprite > pick nearest to bullet.x .. bullet.y

    The second condition always starts picking (choosing) from those picked in the first condition.

    So, it always starts with those 3 'sprites'.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • With a little help from Kyatric, we got to the bottom of this - it seems that you must use "Is overlapping" rather than "On collision with" in combination with "Pick top/bottom instance" or "Pick a random instance".

    I am assuming that it's a bug that "Is overlapping" won't work in this fashion, but I'm not sure.

    Sample project for those that are interested: http://www.sean-noonan.com/development/ ... erlap.capx

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