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?

4 Years
Discussion Span
Last Post by Chuckleluck
Featured Replies
  • 1
    Ezzaral 2,714   4 Years Ago

    You might take a look at the [transform()](http://docs.oracle.com/javase/7/docs/api/java/awt/geom/AffineTransform.html#transform(java.awt.geom.Point2D,%20java.awt.geom.Point2D)) and [inverseTransform()](http://docs.oracle.com/javase/7/docs/api/java/awt/geom/AffineTransform.html#inverseTransform(java.awt.geom.Point2D,%20java.awt.geom.Point2D)) methods on AffineTransform. Read More


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.

Edited by Taywin

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.