How to get the Name of the object in a group.

0 favourites
  • 4 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hi,

    How to get the Name of the object in a group.

    I'm trying to get the value that is in the variable of one of its objects in the group.

    For example, my "Enemy" group contains 3 objects: Enemy1, Enemy2, Enemy3.

    The group contains variables global to the group, e. g. HP, MP, PT.

    Each enemy has different values, I would like to recover

    the value found in one of its variables.

    The problem is, I don't know the name of the enemy in advance.

    The name of "The enemy" will be moved to a function.

    So I get the name of The enemy in one of the parameters of the function

    then I have to get the values of his variables.

    But I can't do: Enemy. Name.

    Have I been specific enough?

  • I think you are looking for


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh yes, thank you!

    But I don't think it has the right name.

    Then how do you get the values of the variables of this object?

  • When there are multiple enemies you likely have to use a foreach loop. Inside the loop you can access the variables normally like enemy.variable1

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