How do I select next empty bucket? (Solved)

0 favourites
  • 8 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • Hey there. Three buckets (sprites) with Instance Values of ID = (0,1,2) and Status = (0,1). When I click on the "add" button sprite, I would like to pick in order of buckets to find the next one that is empty (Status = 0). If it's empty, Status flips to 1.

    However I can't seem to find the way to select the buckets in order using pick by high/low. What would a wise person use here to select the next empty bucket in order?

  • Do you mean in order of ID so 0 then 1 then 2 ? There is system condition 'for each(ordered)' so it can run through them in order of the ID.

  • Do you mean in order of ID so 0 then 1 then 2 ? There is system condition 'for each(ordered)' so it can run through them in order of the ID.

    Correct. ID = 0, then if that one has Status = 1, try ID = 1 and so on.

    I completely overlooked the 'for each(ordered)' [brilliant call] but I'm not sure how to use it to find the next Status = 0.

    When I click on "add" when testing, ALL of the bucket sprites are flipped to Status = 1, not one at a time.

  • Not sure where to put the Left-click and 'for each'

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You don't need to add those extra conditions as it is already running through every sprite. On the actions for the loop you can add set status to 1 and then use Stop loop if you want it to change just one of them.

  • Hmm.... like this caused it worked but I don't want it to be stupid luck.

  • Not luck, it is running through them in order and finding the first one then stopping. Check to see if the correct ones are changing.

  • It definitely is going through them in order. You're a genius! Thanks for the assistance. I learned A LOT today because of you. Cheers.

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