Timer duration tied to variable

Hello, I worked hard and I created a fun little prototype

I have a small question though:

  • When my player score gets over 10, I want the “starSpawn” to go down from 3 to 2.8 so the player notices a small increase in difficulty.

I am having trouble wrapping my head around this as I can’t tie my starSpawn to a variable and just substract from it.

Any ideas?


Hi, in the last block of your events in which you set the value of the playerScore variable as a condition, you can use the same conditions and actions that you use for the ‘star rain’ event - with changed values.

I would suggest that you use the ‘player score’ - condition also for your first star rain event (in this case playerScore equal or less to 10). You actually don’t need to add that to have the stars spawned earlier after increasing the difficulty (because the timer value will be smaller in your second spawn event), but it allows you to understand the events better if you come back to the project after some break and it also prevents unwanted effects if you, for instance, forget to reset the timer in later events.

Edit: After reading the question again I just realized that I didn’t catch what you actually asked and of course Keith_1357 is right.

1 Like

Pretty much any place where you use a number or string can be replaced with a variable(s).

You can replace the number 3 with a variable and then decrease the variable’s value

Timer spawn > Variable(spawnDelay)

And then decrease the variable as an action to your score> 10 condition.
Set spawnDelay minus .3

(You can either start typing the word variable or click the expression builder on the right.)

2 Likes

yes it worked! Thank you so much!

I could have never figured that out by myself, I just wrote the name of the variable!!!

1 Like