Hi guys, weird question here that I'm hoping someone might be able to help me with.
Is there a way to assign a random number...with a certain number having a higher percentage of being assigned than other numbers?
Here's an example:
I have a player sprite, I also have an enemy sprite. When the enemy sprite collides with the player (physics objects btw) I want to subtract say, 20 from the player's health variable.
That's easy enough to do, but I would LIKE to have the damage be more randomized than that. Anywhere from having 10-20 health subtracted...but for the most part I want -20 health to be assigned on average with the 10-19 range only showing up on occasion.
Oi, did I explain that well enough? =
Maybe something like:
Enemy >
On collision with player >
Subtract 20 from Healthvar...but sometimes 10-19 :P
Thanks everyone.