Calling a function for only 1 instance of a family

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • so if I have a multiple instances of "object_1" in my layout and I want them to call a "Flee" function when "Flee" string is active. how do I restrict the function to only the instance with the "Flee" string. currently the behavior of the function is also being called for "object_1s" that have the "roam" string.

    switching strings work fine, its only when the function is called that is the problem

  • If you mean that inside the function there are actions to apply to object with the string flee then you can use conditions inside the function object.string=flee to pick the right one.

    If you are calling the function in an action from the object with string flee and you want to pick the same one then you can send the objects UID through the function as a parameter, then inside the function you can pick object where UID = parameter to ensure it is the same instance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you mean that inside the function there are actions to apply to object with the string flee then you can use conditions inside the function object.string=flee to pick the right one.

    If you are calling the function in an action from the object with string flee and you want to pick the same one then you can send the objects UID through the function as a parameter, then inside the function you can pick object where UID = parameter to ensure it is the same instance.

    thankyou, i get tunnel vision working solo and overlook simple things like this.

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