I am writing a game in Java and it can be likened to the recently popular game "Flappy Bird" in the sense that the character moves up and down and the users touch and must avoid the obstacles.
The obstacles are going to be asteroids of varying sizes. I want to spawn these in at a random y co-odinate and with a random size, and then have them move across the screen. The character must then avoid these.
It cant be completely random however as that may result in an non-traversable path. Thus I thought it would be best to define a random safe path first and then fill in the surrounding area with these obstacles. Is this the best approach to solving this problem, and if so is there correct and efficient way of doing this?