How do I sort an array for an action list queue

  • Hi, I'm working on my first game and I'm trying to build an action list queue similar to The Sims where you can add actions to an array and complete them in order. Then, after an action is completed, that action is deleted and the remaining actions move up within the array.

    Here is my test capx file. Click an action and then click an object to add it to the array. The action should then be performed, then deleted, but it�s deleting all of the actions in the queue.

    https://dl.dropbox.com/u/12221585/capx/arraylistqueue.capx

    I'm a new construct2 user, but I�m not new to programming and arrays, yet after reading everything I can in the Construct2 manual, tutorials, and forums on arrays, I still feel like I don't have a firm grasp on creating and using arrays with Construct2.

    I have worked all weekend on this, and posting here is a last resort for me as I would prefer to figure this stuff out on my own. I seriously appreciate any help you guys can offer.

    thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's the "wait" action that is causing you the trouble. You need some additional states when waiting:

    "false" --- no queued actions.

    "upcoming action" --- countdown to perform actions.

    "true" --- start an action.

    "completing action" --- countdown.

    http://dl.dropbox.com/u/5426011/fixed/n1ch0la5.capx

    I also changed the countdown timer to use dt since every 1.0 seconds was a bit off.

  • Hey thank you for your response! When I try to open the capx file it says it was made in a newer version of construct2, (release 121 and I have release 119).

    I'm going to see if I can get it to work per your instructions tonight after work. I'll look into dt as well.

    thanks again, R0J0hound

  • Hey thank you for your response! When I try to open the capx file it says it was made in a newer version of construct2, (release 121 and I have release 119).

    I'm going to see if I can get it to work per your instructions tonight after work. I'll look into dt as well.

    thanks again, R0J0hound

    You can grab latest releases from here: scirra.com/construct2/releases

  • Man, thanks so much to both of you. It works perfectly.

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