How do I store 10 values in an array

Get help using Construct 2

Post » Thu Mar 06, 2014 5:02 am

Topic seems easy, but it becomes complicated (for me at least) fast

I'm working on a city simulator, and I am wanting to store the value of the Population over the last 10 years.

Currently I am using the following
Code: Select all
(System) If Month = 12  >>> (Array) Push front Population on X axis

And that works fine.

Now I'm wanting to use the same Array and store values such as how many buildings there were, what money was in the back, accidents per year, etc in the X,0,Z, X,1,Z 3,2,Z etc of the array

I can make a long winded coded that takes the value of X+8, Y and stores it in X+9,Y. X+7 and stores it in X+8,Y etc but I'd rather it just push the values along. Which is what currently happens but only in the X,0,0 section of the array.

Could someone please help with this as I'm sure it's not something that is unique to what I'm trying to do. :mrgreen:
Using R248 for all examples
Posts: 382
Reputation: 9,812

Post » Thu Mar 06, 2014 8:38 am

If you want something like :

index 0, population, buildings, money, accidents,
index 1, population, buildings, money, accidents ... etc

Where index is the year. You can do easily do this by adding height to the array. Then right after you add the population you can save the other values with the action "array - set at XY" where X = the year-1 and Y the value index, (1 for building for example, 2 for money ...) and value = your value.

I just wake up so my index maybe false but you have the way to do this !
Posts: 295
Reputation: 6,129

Return to How do I....?

Who is online

Users browsing this forum: Slug101 and 5 guests