I have replicated the classic helicopter game using libgdx. It was fairly easy. Now I want to modify it such a way that the obstacles placement will be a mixture of predefined and randomly generated positions. This way I can also place coins with nice patterns for the predefined groups of obstacles.
To do that, I need to have imaginary grids in the screen using the obstacle size. Then create some groups of predefined positions for both obstacles and coins. Maybe create 10 sets of those predefined levels. Show them once in a certain period of time randomly for the players to have a different feel.
My question is how do I create imaginary grids on a phone screen considering different sizes, resoultion, and densities?
N.B. Please don’t give me links of android developer pages for reading on different sizes and how to handle them. I have read many times and still do read once in a while.
You can account for different size screens by using relative instead of absolute values for your grid. E.g., you can set the height of a cell to be screenHeight/8, rather than “40”. This way, whether the screen is 320 pixels or 400 pixels tall, you can still be sure that your grid will be 8 “boxes” tall.