How do I pick an object from a dynamic string?

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello there, maybe someone can help me out here?

    I want the following thing:

    Step 1 : Write an object name to a string variable, e.g. "wood"

    Step 2 : Do stuff with the object (for example create, destroy, rotate, etc.) based on this string variable.

    I have a lot of different objects and want to write functions that can efficiently do the same thing to different kinds of objects, based on what is written dynamically to this string. I have - so far - not found a convenient way to do this without having to write down EVERY SINGLE case, beforehand, like this:

    If string variable = "wood", pick object wood, etc. etc.

    I hope you understand my problem. Is there some sort of plugin that can help?

    Thanks so much for helping!

    kbm

  • capx? screenshot?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could use function's to get it work

  • Families let you group similar objects together and perform similar operations. Also, the nickname plugin allows you to pick by name.

  • I would probably put them all in a family, and name the default animation the same as the name of the sprite.

    Then "Pick by Evaluate" use the family, and the evaluation as

    Family.AnimationName="Sprite"

    edit: (actually I do this all the time, but instead of a family, I usually have all the sprites as separate animations in the same Object. Then picking by animation name is easy.)

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