I'm supposed to develop a Java game using AWT. I'm stuck with the concept of "collision detection". If you can help me with any tutorials that explain the concept (how it works) or give examples (source code), I'd be grateful.

- 168,117
- 40
- 217
- 433

- 267
- 3
- 8
- 14
-
could you be more specific? do you have a particular issue you are facing while coding? – vijay Feb 01 '13 at 15:13
-
1Pure AWT? No extra libraries? It's going to be a bit tedious and you'll have to implement a lot of things yourself. You should try to look for a library. – LtWorf Feb 01 '13 at 15:13
-
@LtWorf not pure AWT .. I also use applet. – InspiringProgramming Feb 01 '13 at 15:16
-
11) For `Shape` based collision detection see [this answer](http://stackoverflow.com/questions/14574045/image-based-collision-detection-in-java/14575043#14575043) (very easy). 2) *"not pure AWT .. I also use applet"* `java.applet.Applet` **is** AWT based. `javax.swing.JApplet` is Swing based. 3) *"using AWT"* Why? I could understand such a requirement 10 years ago, but not now. – Andrew Thompson Feb 02 '13 at 08:28
1 Answers
A strong tutorial on 2d collision detection can be found at metanetsoftware (makes of N)
The authors write about the theoretical fundamentals and the challenges. They give you some code as well (not awt based but its the same procedure and the code is easy to translate). They cover more advanced topics on their page as well (for example tile-based collision detection)
Update #2: A great conceptual background is given here: GDC 2010 presentation about contact generation
Update: A fairly nice example of how different methods of collision detection work is given in this RUST library. The docs describe some of the techniques and the source code is pretty understandable. Learning from this resource gives you a lot of understanding.
On a side note: the right place to ask that stuff is at the gamedev stackexchange. Since you are just starting in that area take a look at this post