How does C2 select objects with same variable value?

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I have 4 objects with an Instance Variable of the same value.

    Compare Instance Variable. ObjectID = "Enemy"

    Create Text Object.

    Set Text Object.UID

    To test it I have it creating text and setting it to UID.

    It always creates only one text object and it always has the lowest UID for that Instance Variable Value.

    It seems like it checks by UID and selects the first object that has the value, because it always selects the object with the lowest UID.

    I am not sure if it always works like this or is just coincidence.

    I currently have a 2nd variable that allows me to always select a specific object with a specific ObjectID Value.

    I would like to remove this variable if possible.

    I feel it isn't needed, but I don't want to run into errors later on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to enable it manually I think you just need to add the cordova-plugin-crosswalk-webview plugin and reduce the minimum target SDK.

  • Think Ashley has replied to the wrong post....? Either that or I am in the twilight zone

    Unconnected not sure what your question is.. "How does C2 select object with same instance variable value?"

    answer It just does

    your code

    "Compare Instance Variable. ObjectID = "Enemy"

    Create Text Object.

    Set Text Object.UID"

    will only ever show you the uid of one instance

    if you wanted text boxes created for each object with Variable. ObjectID = "Enemy" then use < for each > instead .... no? or am i misunderstanding?

    if you wanted to only select one specific one like the first or last pick based on UID im not sure I would depend on what ever ends up in a text box from the unknown inner workings of construct

  • I only created text to see what UID was selected and how.

    I was sure of it just selecting 1 because of the way the event was set up.

    I wasn't sure if it was looking at more than one before selecting one though.

    I never tried to select 1 object with 4 of the same variable values.

    It has 4 to select from, I was curious on how it selected 1 of the 4.

    It seems it looks at UIDs from low to high and picks the first one that matches the condition.

    I was only wanting confirmation or told how if I were wrong.

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