Arrays in Construct

For questions about using Classic.

Post » Wed Apr 14, 2010 7:21 am

well... after a couple of days of feeling rather stupid, how do the arrays work in construct? I checked over the wiki and didn't really find much information and there were a couple of threads on arrays, but I couldn't get the example files to load. It just kept saying 'unreadable'

Basically I want to have a 5 element, 2 dimensional array... so nothing complicated. I want to sort it, and save it so that next time I start up the program the same array is there. I had this working with a listbox, but I want to see if I can get it to work with an array. Just cause I'm trying to avoid doing what I should be doing today. :P

I think this is probably excessively easy and I'm just missing something that gives me that 'ah ha!' moment... =P :?: :idea: :?:
B
2
G
2
Posts: 10
Reputation: 670

Post » Wed Apr 14, 2010 7:58 pm

An array is pretty simple to set up, just use the Array Object. You can set the height, width and depth in the properties to get the size array you want. The actions for the array handle inputting values, saving and loading data.

I'm not sure about sorting, I don't think there's an automatic way to do it.
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Thu Apr 15, 2010 3:42 am

Just as an addition to UberLou:

You indeed have to implement your own sorting algorithm. Also keep in mind that arrays are 1-based, not 0-based. To setup a twodimensional array of 5x5 you would use 5x5x1 not 5x5x0!
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests