Question

So I guess the best place to start is to give context, for a college project last year I had to design and make an android application, for which I chose to make a game. I decided to go with the idea of a "maze game" that works by using the accelerometer to navigate the screen area while avoiding obstacles. These obstacles I made myself and are mostly rectangle shapes with rounded corners for aesthetics.

My problem with this is, I have "hard coded" 5 levels placing the obstacles where I wish. However to expand this game to say...10 or 20 levels, this would take quiet a bit of time as I have received my grade for the project and now want to further develop the game as a hobby. I suppose it would be beneficial to mention also that, I have not used a physics engine for this game as, I wanted to learn how to code the game without the help/ease of using these engines. This was more of a personal preference more than anything.

Is there a way to "Dynamically" create a level, so the obstacles will remain within the screen area, and place themselves in such a place as to make the game playable (obstacles wont block the whole width to prevent a player progressing to the next level)?

Also, as part of the game, but not covered in the title is another issue I have, and that is, because I have made the obstacles myself, and they are rounded corner rectangles. The JAVA code is written to detect collision of the rectangle (not taking into account the rounded edges) so this makes the game a little less precise than i would have hoped. Is there a way to detect collision of a ball (Circle of specific radius) with a rounded corner rectangle?

Was it helpful?

Solution

Its hard to know without details of how you place the the obstacles.

One suggestion, get the screen size of the device and use Math.rand() in the x and y direction of the device screen to place the obstacles

As for the second question, these may be helpful

Collision detection : rounded object

ball collision detection

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top