24 February 2007 - java_dev (original) (raw)
| | 10:36 pm - battie42 - Keeping shapes from overlapping Hello.I've done a lot of work in Java, but very little with GUIs. I'm trying to design a children's game that involves a field of obstacles. The obstacles are randomly placed, which is easy enough, but I'm not sure how to go about making sure none of them overlap without writing a whole lot of bloated code (right now everything is in a neat loop, but I don't think that's possible if I want to make sure no two objects share coordinates). Furthermore, there will be another object that must navigate through the obstacles. It may touch, but cannot pass through, any of the obstacles.Again, I'm sure I'll find a really loooong way to go about this, but this must be an issue game programmers deal with constantly. Are there any methods that will detect the presence of other objects? I've tried searching for them but any keywords I come up with seem to be too general. I'd really appreciate any suggestions.Thank you! |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |