Need help with changeing (every x seconds) system command

Get help using Construct 2

Post » Tue May 02, 2017 6:18 pm

so basicly ive made it so...

on Right arrow pressed, Spawn sprite 2 on sprite 1
(system) every 1.0 seconds
on Up arrow pressed, Spawn sprite 2 on sprite 1
(system) every 1.0 seconds
on left arrow pressed, Spawn sprite 2 on sprite 1
(system) every 1.0 seconds
on down arrow pressed, Spawn sprite 2 on sprite 1
(system) every 1.0 seconds


and say i get a power up for my character and i want to change All of the (system) every 1.0 seconds at the same time and keep it that way thought the entire game, how would i go about doing so?
B
5
Posts: 1
Reputation: 227

Post » Tue May 02, 2017 7:15 pm

Hi @dmt90001

If you want to change all the 1 seconds to 2 seconds:

1) add a global variable spawnTime and set it to 1.
2) replace the "1.0" in each "every 1.0 seconds "so that it reads "every spawnTime seconds".
3) on power-up collected change the value of spawnTime from 1 to 2.
B
19
S
8
G
3
Posts: 423
Reputation: 3,964

Post » Wed May 03, 2017 2:18 am

Yep. As mekonbekon has said, use a variable to control things that you want to, vary, at runtime.

Using variables is an easy yet powerful way to change anything in your code on the fly... I even use them in the design process when I'm experimenting with things, so that I don't have to change a value in 10 different events... I can just change a global variable value and it does everything else for me!

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Fradno, Google [Bot] and 17 guests