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

Just started using Construct 2? Post your questions here

Post » Sun Oct 18, 2015 11:06 pm

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.
Last edited by Callan S on Mon Oct 19, 2015 3:03 am, edited 2 times in total.
B
50
S
14
G
4
Posts: 189
Reputation: 5,508

Post » Sun Oct 18, 2015 11:41 pm

try this one Array.capx

Image

OR

Image
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Mon Oct 19, 2015 12:36 am

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.
B
50
S
14
G
4
Posts: 189
Reputation: 5,508


Return to Beginner's Questions

Who is online

Users browsing this forum: bobcgausa and 1 guest