Changing Spawn Rate According To Score?
Tim_A
Member, PRO Posts: 60
Hi all,
I'm trying to achieve something that i thought would be straightforward but is stumping me at the moment...
I'd like the spawn rate of the chosen actor to increase according to the score.
I have an integer for the score which works fine, and have added the attribute (integer) 'ratebirds' for the spawn rate, and set it to '3'.
For some reason, simply setting a rule that 'when score = 5, rate birds = 2' doesn't seem to work. I can't seem to use one integer to influence another?
Does anyone have any ideas?
Regards
Tim
I'm trying to achieve something that i thought would be straightforward but is stumping me at the moment...
I'd like the spawn rate of the chosen actor to increase according to the score.
I have an integer for the score which works fine, and have added the attribute (integer) 'ratebirds' for the spawn rate, and set it to '3'.
For some reason, simply setting a rule that 'when score = 5, rate birds = 2' doesn't seem to work. I can't seem to use one integer to influence another?
Does anyone have any ideas?
Regards
Tim
Comments
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Create two real attributes called game.lastSpawnTime and game.spawnDuration. Set game.spawnDuration to how long you want to wait until the first spawn occurs (e.g. 3 would mean 3 seconds)
Create this rule:
When game.Time > game.lastSpawnTime + game.spawnDuration
Spawn actor [actor name]
Change attribute game.lastSpawnTime to game.Time
Then, in any actor you like, you can change game.spawnDuration to adjust the frequency of spawning.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
thanks for the reply, that makes perfect sense why I couldn't get it to function properly!
I've setup the above, and initially the timed spawn seems to works fine, but on scene reset, the spawn only works once then stops entirely?
Do I have to reset the game.Time somehow?
Regards
Tim
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User