Why are we not using our cached reference?

image
I tested it with simply changing the X,y coordinates to our cached reference and it works fine but the way rick writes it seems unneccecary. What am I missing? I tested it with 100 and it goes crazy too

EDIT: nevermind I realize he did it this way as to not affect the speed of the velocity but just the direction alone. Correct?

Looking other questions on the tag this seems to deal with the “avoiding bouncing loops”, right?

Rick uses Random.Range(), to select a random value between zero and the cached randomFactor. If you just use randomFactor, the velocity tweak will always be the same, as the same value is always used, the one you assign in the inspector or on the variable initialization.

You can perfectly do that, as the solution fixes the problem. It becomes more a matter of preference. Using Random.Range() makes the behaviour less predictable, which makes the gameplay become more interesting. It’s always important that the player has a feeling of outcome uncertainty, they know how the behaviour should go, but now how specifically. That keeps them engaged. However, too much randomness can take away from them the feeling of being in control, making them think the game is unfair. So it’s a matter of testing to get the correct amount of randomness.

1 Like

Very true. I couldn’t agree more

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

Privacy & Terms