pick an object by dynamically supplied name

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello.

    Is there a way to pic an object by dynamically supplied name ...

    a. in condition?

    b. in expression?

    Like: MyObject & n

    Thank you.

    Konstantin.

  • When creating the instance "dynamically" store the UID in some array. Or use an instance variable that is different for each instance of the object so that you have a reference that allows you to pick only the specific instance you're looking for.

    If you want to have different instances of a same sprite displaying different frames, be sure to load/display the correct animation frame and have the animation at a speed of 0 so the frames won't switch.

    Perhaps you're asking the wrong question here though and should actually explain exactly what you are trying to achieve to see if the current method you are applying is the most appropriate.

    Also, as you can see I moved your topic as it is an help request that fits better to the "How do I" forum.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could try the nickname plugin. I only just learned about it but search the plugin forum.

  • I was so much pleased with answers to my questions from this forum.

    The forum is one of the "pros" of choosing C2.

    Kyatric and codah, thank you for your carefully written answers.

    Now back to the topic:

    1.

    Not every language has dynamic names. Not a big problem.

    On trade-off side, c2-IDE can refactor object-names by one click.

    2.

    I asked for "dynamc-names" only because of, in my case, c2 half-fails to pic by UID.

    This is either my fault or c2-bug described in example on the bottom of the picture in event "65".

    3.

    Yes, i must look at "nickname" plugin.

    I no longer need the answer because no time to do my own research and "homework on c2".

    Thank you.

    K.

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