Accurate 2d array iteration work with C2 List UI [capx]

0 favourites
  • 9 posts
From the Asset Store
Project File of my C3 Tutorial Customized DropDown List
  • First of all, I would like to make the following work.

    How do I iterate through my array in such a way that the C2 list displays values according to array’s rows? Like so:

    List index 0: displays: array row 0.

    In other words I want to get:

    Index 0: arrayValueEntered1, arrayValueEntered2, arrayValueEntered3

    Index 1: arrayValueEntered4, arrayValueEntered5, arrayValueEntered6

    Index 2: arrayValueEntered7, arrayValueEntered8, arrayValueEntered9

    Thus all values like in the array but separated by a comma.

    The only working thing I could come up with was to iterate using “For each XY element” but it obviously does not do what I intended.

    I tried to build a while loop since I do not know how many rows there will be and then I nested a for loop since I know that I will have three values in my array in its height. Unfortunately I cannot make it work.

    Thus, can you either correct my looping to achieve the desired effect or add a proper way of iterating to achieve what I am aiming at?

    My secondary question is related to my goal, which is the most accurate representation of the array in a visual way. I chose to use the list but even if the above works, which even now does not at the moment of writing, I still would not be able to precisely change the values, only whole rows. Would there be a more accurate user interface to manipulate the array in the file so that the user could choose particular values to change?

    capx for correction below:

  • This is from another thread, but shows how to address the array with two for loops.

  • Thank you.

    It is somewhat helpful, however it still prints according to the pattern below








    Whereas, my array should be printed in the list like so:




    In hardcode it would be something like:

    List: add item:,0)&”,”&,1)&”,”&,2) at index 0

    add item:,0)&”,”&,1)&”,”&,2) at index 1


    The question is, how to do it with a nested loop in C2?

    It seems a printing pattern is required to display the array like the pattern below but shorter:

    Subscribe to Construct videos now

    I still cannot get it in C2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The nesting is clearly defined. You loop in Y, then X. Or reverse them for the other direction.

  • The pattern i am looking for to display in Construct 2 List, not in a text object, would look like this following your [blackhornet's] example:

    List in Construct 2:

    0: 0,5,10,15,20,25,30,35,40,45

    1: 1,6,11,16,21,26,31,36,41,46

    2: 2,7,12,17,22,27,32,37,42,47

    which appears to be the visual representation of the array from Construct 2 debugMode. In other words, the list contains array rows and their indexes should match, which allows a removal of an entire row both from the list and array by means of array pop. Besides the List in C2 does not work the same as the text object.

  • try:


  • That is exactly what I have been trying to do! Beautiful result korbaach! You are super great! Thanks for letting me learn something new!

    I also assume that there is no other way of representing the array graphically so that the horizontal values could be manipulated from the GUI instead of this one, where “horizontal values” are “frozen” in the list and are not clickable but still the user can delete an entire row and has a sense of what is going on, isn’t there?

  • only in two steps..


  • I would not even think to do it in such a way, that is remarkable!

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