How do I functions to spawn every X seconds

Get help using Construct 2

Post » Mon Oct 13, 2014 9:06 pm

Hi, i have a question, i want to create a function that creates some enemies when i click a button:

-on button clicked - call function "bla"

-on function "bla" -
-every 5 seconds - create enemy ..............

but when i try the code it just create one enemy not enemies every 5 seconds. how can i do this with functions?
thank and sorry for my english! i hope you guys can understand my question!
B
8
S
1
Posts: 34
Reputation: 434

Post » Mon Oct 13, 2014 9:09 pm

functions are triggers. which means they only run once. you could call the function every 5 seconds instead.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Mon Oct 13, 2014 9:12 pm

the problem was i was going to pass information thru the function to set the "every x time"
B
8
S
1
Posts: 34
Reputation: 434

Post » Mon Oct 13, 2014 9:13 pm

so.. another way to do it?
B
8
S
1
Posts: 34
Reputation: 434

Post » Mon Oct 13, 2014 9:15 pm

you basically answered yourself.. :D
spawn every X seconds...

use a variable!
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Mon Oct 13, 2014 9:23 pm

Yes you are right! sorry! i dont know what i was thinking lol!
B
8
S
1
Posts: 34
Reputation: 434

Post » Mon Oct 13, 2014 9:23 pm

THANKS!!
B
8
S
1
Posts: 34
Reputation: 434

Post » Mon Oct 13, 2014 9:28 pm

There are also several tutorials on this subject as well...

Click the tutorials link at the top and then enter the word spawn in the search box...
B
11
S
2
Posts: 46
Reputation: 739


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], chrisyamao, ksiads and 5 guests