How do I Determine an array element is empty and add value

  • Hi everyone!

    I have ran into a problem, I am trying to add a value to the X axis of an array, I want to add this value to the next empty element inside the array.

    Example: Each X element is marked a "[]"

    How could I add a value to the 4th element where it is blank?

    [11321][127556][456546545][BLANK][BLANK][BLANK][BLANK][BLANK]

    I know how to insert values into the array if they are fixed, but what if this array is dynamic? After some values have been inserted.

    Summary:

    How do I add a value to the NEXT AVAILABLE blank array element.

    Thank you

  • Can you start with an array of width 0 and just push new values onto the end of it? Or do you need those blank elements in there?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you start with an array of width 0 and just push new values onto the end of it? Or do you need those blank elements in there?

    I already had a system working but was much more complicated than what you had suggested, so I went with your idea. Much more simple. Thank you.

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