Random grid of squares

This forum is currently in read-only mode.
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • I'm trying to make a 5x5 grid of text files to fit into a grid of squares. This should be simple enough but every step of the way I'm blocked by a lack of features.

    I first put all possible texts into a listbox object. Then I created the text files with 2 loops and gave them unique values. This worked and displayed the text from the listbox properly but was not random.

    I tried to find a way for the listbox to move its lines around but I can't find a way to move existing lines at all. Then, I tried to create a duplicate listbox object and insert lines from it into random indexes (Not that that would produce very much randomness). It didn't work, as if the index number exceeded the existing line number it ignored the action.

    I then tried to skip the inserting, make 25 dummy lines, and then randomly rewrite those lines from the original listbox object. The only problem is there's no way to rewrite lines that I can find. "Set line data" doesn't seem to do anything.

    There has got to be an easier way of doing this, but man I hate the listbox object...

  • Hmm, I have no clue what you are talking about mr.

    I'm blocked by a lack of features.

    No. Go wash your hands.

    But seriously, post a cap or a picture or something!

  • Then, I tried to create a duplicate listbox object and insert lines from it into random indexes ... It didn't work, as if the index number exceeded the existing line number it ignored the action.

    Not sure what you're trying to do here, but if the insert line action only takes an index from 1 to number of lines, then random(number_of_lines) + 1 should insert to a random, valid place and will be totally randomly shuffled.

  • The ignoring of inserting lines if it's beyond bounds is standard Windows behavior. What is possibly necessary is a virtual list object which can be sorted and shuffled, then iterated. Until then there are many different ways to do what you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, I have no clue what you are talking about mr.

    > I'm blocked by a lack of features.

    >

    No. Go wash your hands.

    What do you mean "no." I was talking specifically about the listbox object here, so unless you know something I don't, it doesn't have the ability to rewrite existing lines or to rearrange them.

    Anyways, it turns out inserting lines from one listbox to another with random(number of lines) as the index does properly shuffle them, so thanks, Ashley.

  • Sorry, didn't know that you were referring specifically to the listbox object . But.. As you see, there was a workaround.

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