Java Collision Detection With Polygons

Java Collision Detection With PolygonsI’ve been asked many times to create a program that handles Java collision detection with polygons. This is a continuation of my tutorial on how to make a Java video game and if you haven’t been watching you should check it out.

It is surprisingly easy to handle collision detection with polygons. All you have to do is surround all of your polygons with rectangles and a handy dandy method named intersects handles pretty much everything else!

All the code follows the video.

If you like videos like this, please tell Google by clicking here [googleplusone]

Sharing is also appreciated [nttfblike]

Code from the Video

GameBoard.java

Rock.java

SpaceShip.java

6 thoughts on “Java Collision Detection With Polygons”

  1. Thank you so much. I’ve been using various online resources to teach myself how to code, and yours have been the most helpful so far.

Leave a Reply

Your email address will not be published. Required fields are marked *