[Solved]Every X seconds only runs 'for each x element' once?

0 favourites
  • 3 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Not much help on the last question, but here I am again. I have 'every X seconds' and I want to run something for every element of an array.

    It works once, but then does not repeat in the next X seconds (with whatever I have X set to)?

    I basically want to move each number in the array along by one. So if I had '1,2,3,4' I'd want it to become '0,1,2,3' then '0,0,1,2' and so on. But it only does the first step?

    Edit: Self solved, I think. Because of the requirements of my project, the numbers did not appear to be moving because I was shifting them along by one and raising them (and removing the last) - thus setting up the same set of numbers over and over. So I'd set up an illusion for myself! Though the way I had to do a fairly simple array manipulation was, I have to say, far more complicated in construct.

    Thanks to korbaach for their help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • try this one Array.capx


  • Thank you, korbaach!

    If you can help me further, I also want to modify each variable, which would seem simple enough but I can't figure out how construct wants me to do it?

    For example, as well as moving the numbers I want to add 1 to each first.

    So it would go '0,1,2,3,4,5', '0,0,2,3,4,5', '0,0,0,3,4,5', etc*

    I am trying to use 'for each X element' along with each tick but it doesn't seem to work?

    If I was using basic I'd just have a loop running backwards through the array, making each variable equal to the one just before it, then adding one. And that'd work. But here I have no idea how construct wants me to do this?

    * Also latter on I want it to only add if it's below 120. If its at 120, it does nothing. I'm using it as the track of plant growth, with 120 being an adult plant. Each adding of '1' to a plant represents a days worth of growin.

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