How do I store 10 values in an array

0 favourites
  • 2 posts
From the Asset Store
80 pieces of loopable game music, 10 game overs and 10 level complete pieces.
  • 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

    (System) If Month = 12  >>> (Array) Push front Population on X axis[/code:3ck04xf0]
    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.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 !

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