How do I access family members of certain object type

0 favourites
  • 2 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • I have 4 family members

    • object type: sprite, name: asteroid
    • object type: sprite, name: player
    • object type: sprite, name: enemy
    • object type: sprite, name: obstacle

    all of this four have Health Points so i added HP variable to family.

    -------------------

    Now: when enemy shoots to player i want to take 1 hp point from player's hp, but Player object has no HP variable - HP Family has it, so i have to detect collision between bullet and entire HP family. Now enemy bullets destroy everything, obstacles, asteroids, another enemies...

    The question is: how can i detect collision between enemy bullet and player and take 1 point from it's HP family instance variable.

    -------------------

    And second question:

    since Family members can't contain other objects such as HP text object - i have to create Text object in for each loop through entire HP Members family, but I don't want to create text object for obstacles in this family, because it's not important to show how much energy obstacle has left. How can i remove only obstacle object types from this loop.

    Any help will be appreciated

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You should be able to access the family instance variable on the object.

    You could add the three objects that need text objects to another family and use that for text.

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