I am trying to build a simple java game that will randomly spawn enemies for users to shoot down.
My game calls a method 60 times every second. I would like it to randomly perform an action every once in a while, in this case, spawn an enemy.
I found that using when using Math.random() and saying for example, < 0.1, as in a 10% chance it spawns too much because of the 60 frames per second. I would greatly appreciate any suggestions as to make this work better.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire