How do I select an image to create from data in an array?

0 favourites
  • 4 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I'm making a flashcard-based game to help me learn French.

    I'm looking for a way to spawn an image into a layout based on data from an array which contains all the card data. I have an image in my project and its name matches the value of a value in the array, but when I try to create an object from a string based on that value nothing happens.

    Alternatively, I tried pushing the value of the cell into a variable and then calling the variable when creating the object. I can see the variable is set correctly in the debugger, but it also doesn't create the object.

    What am I doing wrong exactly? Or is this not possible for some reason?

    Here's my project file.

  • 1-Your Array JSON Data includes extra symbols at the end of the Name "Values" that's why does not match the name that you are trying to spawn on the "LoadImage" Variable

    LoadImage Value ="beaucoup"

    Arra Value= "beaucoup\n"

    Remove the "\n" at the end of the values and it should work

    2-Also your second issue is the layer where your spawn the image "Back" you have it invisible by default so you not gonna see the image spawned unless you set it to Visible

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you, this worked! Yes, I should've mentioned I was immediately clicking in my project to test if the image would show. It's to simulate the card flipping over essentially.

    I'm a bit surprised the trailing space doesn't appear when I try to use the array editor itself. It actually remains in there unless I right-click > clear cell > and retype in the value (simply backspacing to clear it doesn't work).

    This scenario makes me not really trust using the array editor much, as I can see a number of other cells there with the hidden trailing character.

  • I think /n is a newline rather than a trailing space. If it doesn't show up in the array editor, I'd say that's worth a bug report to fix.

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