First time poster on these forums so I hope somebody is able to help or point me in the right direction.

I'm currently writing only my second ever java game from scratch, not using a framework of any kind yet (maybe that would help with this issue), but have run into a problem that has me a little stumped.

The game i'm working on is a missile command style game, however with real missile sprites raining down on city sprites. Now I have my AffineTransform rotating my missiles to the correct angles (which are randomly generated) based on a start and end X and Y (again both randomly generated) BUT my bounding box for each missile is obviously not rotating with the missile. The even bigger problem is that even if I get the bounding box to rotate to envelope the image the image itself has too much blank space either side which would count as a collision when none actually occurred.

Is there some way for me to implement a smaller bounding collision box for my larger image which also follows the rotation of that image?? If only the tip of the missile counted as a collision instead of the whole missile that would be a bonus!

At the moment my missile image is 40 x 40 but the actual missile is only around 40 by say 12 with the rest being transparent. The reason I changed it to 40 x 40 was so that when I used AffineTransform the rotation worked, whereas when the image was 40 x 12 the rotation would not work correctly.

If this is the problem then I can post my code and maybe somebody can point me to the correct way to rotate a 40 x 12 image the right way along with the bounding box?

You can also make your collision area using a Polygon. Or, building it from multiple Circles/Rectangles. The benefit of the latter solution is that you can use sequentially smaller "level of detail" for more efficient collision checking. Here's an image to demonstrate:

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org