I need to create a system where something will be randomly generated but with more objects being spawned closer to the max number.
Specially I would like to create a sort of mining game. I want to have all the gems spawned randomly underground but as you go deeper, gems become more common.
Kinda like this image
I have no problem spawning these gems at the X position. That will just be a random value of screen width. Its the Y value I am stuck on. For example, shiny rocks can be found at y=0 through y=100. I would like to randomly spawn say 30 rocks at random heights but somehow weight the randomness so that more rocks appear closer to y=100.
A Chart like this
samedi 16 décembre 2017
I need to create a method for a weighted random function
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire