How do I sort an array for an action list queue

Get help using Construct 2

Post » Tue Mar 19, 2013 12:48 am

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 its deleting all of the actions in the queue.

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

I'm a new construct2 user, but Im 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!
B
3
Posts: 3
Reputation: 681

Post » Tue Mar 19, 2013 2:38 am

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.
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769

Post » Tue Mar 19, 2013 1:54 pm

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

B
3
Posts: 3
Reputation: 681

Post » Tue Mar 19, 2013 2:08 pm

[QUOTE=n1ch0la5] 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

[/QUOTE]

You can grab latest releases from here: https://www.scirra.com/construct2/releases
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Tue Mar 19, 2013 3:24 pm

Man, thanks so much to both of you. It works perfectly.
B
3
Posts: 3
Reputation: 681


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], kamens503 and 26 guests