Why does the randomness in the firingrate not affect the player ship shooting?

Hi,
I wonder why the random factor does not take effect when the player fires, although it is the same coroutine in the same script. Can someone help me understand this? There is no query in here if it is an enemy.

Hi,

Welcome to our community! :slight_smile:

If you are referring to your code and your project, it would be great if you could share the relevant code as formatted text here.

And what do you mean by “same coroutine” and “same script”? In C#, we use objects. The names migth be the same but the objects aren’t.


See also:

We set up a firingRateVariance field which is set to 0 by default.

The coroutine picks a random number between baseFiringRate - firingRateVariance and baseFiringRate + firingRateVariance

So for the player, the routine is picking a random firing rate between 0.2 - 0 = 0.2 and 0.2 + 0 = 0.2 which should always return the same value: 0.2.

For the enemy, it is picking a random number between 1 - 0.5 = 0.5 and 1 + 0.5 = 1.5

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms