This might be a general math question, so excuse me if it doesn't belong here.
I have an airplane that flies around the screen. Pressing the W key will make it counterclockwise, and pressing the S key will make it rotate clockwise. When I press space, it shoots bullets. However, as it stands, the bullets begin at the top left corner of the image.
My question is, how do I find a coordinate point (specifically, x33 y10) on the image (so if the image was at x400 y300, the point would be x433 y310), regardless of the rotation?
If that wasn't very clear, consider this image: https://dl.dropbox.com/u/56274235/planeexample.png (Blown up for convenience.)
I want to find the green dot, regardless of the facing of the plane. How do I do that?

Recommended Answers

All 3 Replies

Do you know the value of the current rotation angle of the image when space is being pressed? If you could obtain such value, you can simply compute the point by doing the point rotation using the center of the image as the origin point.

You might take a look at the transform() and inverseTransform() methods on AffineTransform.

Ah yes those transform() methods work great. Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.