You have a couple different options, the easiest is probably to make transitional sprites--all angles of the tank you wish to show and transition them along the same idea as a shot animation/movie.
If you have a line graph plotted tank/object, then you can get familiar with sin/cos functions and how they relate to your angle of view and project the verticies from a common point of observation.
Hi cjren,
If you want smooth rotational movement use affine transform as morgair suggested. There's loads of posts on the forums on how to do that specifically for tank games.
When you want to move your tank you'd do something like this . . .
AffineTransform imageLocation = new AffineTransform();
...
dx=Math.cos(Math.toRadians(angle))*velocity;
dy=Math.sin(Math.toRadians(angle))*velocity;
pX=pX+dx;
pY=pY+dy;
imageLocation=AffineTransform.getTranslateInstance(pX,pY);
imageLocation.rotate(Math.toRadians(angle)+Math.PI/2, CENTRE_IMAGE_WIDTH, CENTRE_IMAGE_HEIGHT);
Good luck,
Has
:-) finally, My tank is built up as a polygon, so I write a method rotateVertex(Point2D p2d) to transform the angle of the tank. But for tank is not built up by image, so the look of is ugly.
"affine transform " is a good thing, but from the tutorial I think it was used for coordinate transform.
thx.