[SOLVED]How do I get function to repeat itself?

Get help using Construct 2

Post » Mon Aug 10, 2015 1:48 pm

Hello World,

So what I want to do is ramp up the difficulty in my game. So once a certain score is reached I want a function to be called and that function to start spawning an object every "timersine" seconds. Timersine is a variable that I change in other places.
As you can see from the pics below I tried in various ways to make this work and failed every single time. Usually I manage to just hang the browser and get "script has stopped working" errors.
Please help, what am I doing wrong?

Thank you.

Image
Image
Image
Last edited by VIKINGS on Mon Aug 10, 2015 2:16 pm, edited 1 time in total.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Mon Aug 10, 2015 1:56 pm

You should delete the while loop and just have the following condition:

1/ every timersine second
2/ score is between low score(eg 200) high score(eg400)
---> call function
3/ score is between low score(eg 401) highscore(eg 600)
---> call function
---> wait 0.1 sec
---> call function
4/ score is between .... etc
Last edited by MadSpy on Mon Aug 10, 2015 2:02 pm, edited 1 time in total.
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

Post » Mon Aug 10, 2015 2:16 pm

Yeap, that worked @MadSpy . Thank you.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Mon Aug 10, 2015 2:19 pm

You're welcome
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005


Return to How do I....?

Who is online

Users browsing this forum: dop2000, mcscooter and 23 guests