How do I randomize array items from function?

0 favourites
  • 4 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I have it working fine when the function is called at startup, but it doesn't work when triggered by a button click. I don't understand. Thanks for any assistance.

    dropbox.com/s/oqdj6m2xjlf0zti/random.c3p

    I would also really like to put each letter into it's own text box, but I have failed miserably in my attempts to do this. Any guidance would be appreciated.

  • First thing, don't call randomize after a wait action on start of layout. Move it to event 2 instead, as you have no way of knowing for certain if the Ajax request will complete in .0001 seconds or 10 seconds.

    What is your default array size? From what I can see, your randomize loop will delete all your array x indexes after being run once. The second time, the loop will run for 0 to -1, since your array width will be 0 by then.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First thing, don't call randomize after a wait action on start of layout. Move it to event 2 instead, as you have no way of knowing for certain if the Ajax request will complete in .0001 seconds or 10 seconds.

    What is your default array size? From what I can see, your randomize loop will delete all your array x indexes after being run once. The second time, the loop will run for 0 to -1, since your array width will be 0 by then.

    Thanks, it's x=5. now I understand, I'm deleting everything from the array, so if I want to refresh it with the same content, I will need to recreate that content first, right? Make a sub-function that repopulated the array?

    That's not what I really want to do in any case. I will just move on to the next y row after the user has satisfied some requirement.

  • Deleting the x index will delete all associated y values as well. Think of deleting x as deleting the entire column

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