0 Favourites

Check family to destroy object problem

  • Hello,

    I would like to ask if this is common and right or a bug:

    I'm checking a family overlapping an object:

    • Family Bullets is overlapping Player: Destroy bullet;

    and it's destroying all the bullets on the screen.

    But I supposed to check a family and destroy the object would give me the able to check any type of bullet and only destroy that I told him.

    So, going ahead with this mentality, I can make bullets that can pass through the player and others being destroyed on contact.

    But by the other side, I could check the family and make to destroy the family, but that check didn't encapsulated the event only for the specific object meeting the conditions?

  • I think its right Telles,

    Since you test the family, the family object is picked but then you give the command to destroy the 'general' bullet object without specifically choosing one, so it picks all of them.

  • GenkiGenga

    But so, it's the same of destroy the family, right?

    It's not better to destroy only the instance checked, instead of the whole family on the screen?

    And give the possibility to destroy the family by making it destroy the family?

    Just brainstorming.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • TELLES0808

    Im not sure I understand what you mean (my apologies if that is the case).

    If you destroy the 'bullet family object' instead of the 'general bullet object' then only that 1 should be destroyed since it is picked in the event.

  • Hello,

    I would like to ask if this is common and right or a bug:

    I'm checking a family overlapping an object:

    - Family Bullets is overlapping Player: Destroy bullet;

    and it's destroying all the bullets on the screen.

    But I supposed to check a family and destroy the object would give me the able to check any type of bullet and only destroy that I told him.

    So, going ahead with this mentality, I can make bullets that can pass through the player and others being destroyed on contact.

    But by the other side, I could check the family and make to destroy the family, but that check didn't encapsulated the event only for the specific object meeting the conditions?

    When you use families for collision check to destroy a general bullet then its going to assume if any sprite object in your "family" collides with player, then only the general bullet is destroyed. If your general bullet is in the family as well then it would be destroyed too.

    Its gonna depend moreso on what your wanting to achieve. You could normally check for the instance of an object, if that same particular object is placed on the screen more then once, maybe then you would check the instances of the object and destroy the one you want to destroy. Now if you have all the general bullets in the family and you want them all to be destroyed, then family would be the easiest way since there basically grouped together as one sprite type.

    But if there's a specific bullet you want to be destroyed, and you want the others to be in the screen, then go for the instance check instead because then you could target which bullets be destroyed, and which bullets be on screen.

    I'm still a bit fuzzy on what I had just read

  • If you check for collisions within family, you should also set the destroy event to the family, not individual bullet object.

  • TELLES0808

    Im not sure I understand what you mean (my apologies if that is the case).

    If you destroy the 'bullet family object' instead of the 'general bullet object' then only that 1 should be destroyed since it is picked in the event.

    Thank you, so, if you check a family, and if it meet the requirement, and I destroy the family inside the event, it will work only for the family object who is meeting the requirement?

    I was thinking exactly the inverse, but this way make sense too.

    Later I post here the two procedures and their real results with a sample file.

    When you use families for collision check to destroy a general bullet then its going to assume if any sprite object in your "family" collides with player, then only the general bullet is destroyed. If your general bullet is in the family as well then it would be destroyed too.

    Its gonna depend moreso on what your wanting to achieve. You could normally check for the instance of an object, if that same particular object is placed on the screen more then once, maybe then you would check the instances of the object and destroy the one you want to destroy. Now if you have all the general bullets in the family and you want them all to be destroyed, then family would be the easiest way since there basically grouped together as one sprite type.

    But if there's a specific bullet you want to be destroyed, and you want the others to be in the screen, then go for the instance check instead because then you could target which bullets be destroyed, and which bullets be on screen.

    I'm still a bit fuzzy on what I had just read

    That's the point, if I assume to check any bullet of the family is on collision, but destroy only the specific collided bullet, I'll need to check all the individual bullets again?

    If you check for collisions within family, you should also set the destroy event to the family, not individual bullet object.

    If this is the case, family is only about the entire group and don't have use for their individual objects inside the family?

  • Thank you, so, if you check a family, and if it meet the requirement, and I destroy the family inside the event, it will work only for the family object who is meeting the requirement?

    I was thinking exactly the inverse, but this way make sense too.

    No worries Telles.

    Exactly, I can see what you mean too since the bullet is technically part of the family anyway you would think that it was picked in the same way but it isnt.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,500
DMT2005's avatar
DMT2005
Unread hot topic
102 6,404
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
123 14,873
Zebbi's avatar
Zebbi