Hi I am working on my first game a basketball style game and I have a function that spawns the net at random places on screen.
I am trying to figure out the logic on how I can spawn a coin at random times during the game.
So for instance, I dunk the ball in the net and a new net is spawned and maybe after 1-8 dunks from the start of game without a coin, then between the next 9 - 20 play, I want to spawn the coins not 10 times but maybe 4-5 times within that 10-20 play window.
The only idea that came in my mind is to hardcode the play like "when score is 9, then spawn coin". Next when score is 13 then do same and etc but this will hard to manage since my game is not level based.
Any ideas pls.