[SOLVED] How do I make an accelerating counter?

Get help using Construct 2

Post » Fri Nov 11, 2016 3:49 pm

HI in my app i need to create a counter who do this

the counter count, 1,2,3,4 and then restart 1,2,3,4 but faster everytime the counter finish to count 1,2,3,4
Last edited by imothep85 on Sun Nov 13, 2016 2:58 pm, edited 2 times in total.
B
39
S
16
G
7
Posts: 1,727
Reputation: 9,865

Post » Fri Nov 11, 2016 8:07 pm

Well, you probably got code that looks like this:

Every X seconds: Add 1 to counter.

What you do now, is, you create a variable called "interval" for example, initial value could be 2.

You insert that variable into the "Every X seconds" condition at the position of the X.

Next and last thing is to add an action underneath the "Add 1 to counter", being:
Set "interval" to: interval - (counter % 4 = 0 ? Y : 0).
Replace Y with the amount of seconds you want the interval to decrease.

This assumes that your counter starts at 1 and not at 0. If it starts at 0, put counter+1.

If you need any more help or a .capx, give me a shout.
(A .capx always explains better)
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sat Nov 12, 2016 7:32 am

yes a capx please :D
B
39
S
16
G
7
Posts: 1,727
Reputation: 9,865

Post » Sat Nov 12, 2016 9:12 am

i created here a picture for explaining my problem.

i have a sprite "player"who need to spawn at 4 differents positions (1,2,3,4) randomly but accélérating, how to achieve that?

https://s18.postimg.org/losif93jb/positions1.jpg
B
39
S
16
G
7
Posts: 1,727
Reputation: 9,865

Post » Sat Nov 12, 2016 9:04 pm

Hm, so the character spawns at 1, then at 2, then at 3, then at 4 and then starting over again?
And that should happen accelerated over time?

Or what exactly should be accelerated?

I created a .capx for you, assuming you want the player to appear at 1,2,3 or 4 each time.
If I misunderstood you and you want the player to appear at each position once, that shouldn't be too hard to convert my .capx for your purpose.

Download .capx
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sun Nov 13, 2016 2:58 pm

Thanks i solved this!!!
B
39
S
16
G
7
Posts: 1,727
Reputation: 9,865


Return to How do I....?

Who is online

Users browsing this forum: Christmas and 56 guests