I am drawing my background, which draws all objects except the player (who is centered), I have the float facing and x and y for each object.
Then I translate and rotate to keep my player centered, but allows him to rotate. Then I translate back to draw the HUD on screen space.
During the draw of the background, if I try to rotate a remote player, it throws everything off.
Sample code, not working code:
1 2 3 4 5 6 7 8 9 10 11
| sector.render(g);
AffineTransform at = new AffineTransform(); at.translate(screenWidthMiddle-(shipWidth>>1), screenHeightMiddle-(shipHeight>>1)); at.rotate(facing,shipWidth>>1,shipHeight>>1); g.setTransform(at);
player.render(g);
at.translate(-screenWidthMiddle,-screenHeightMiddle); g.setTransform(at); |
during the sector render, if I use an AffineTransform to only rotate the remote players ship, it spins on an unkown axis.
Any thoughts?
I know the first will be to not use AffineTransform to rotate and I know you cna use 16 or so pre-rotated images to get a smooth rotation, but I like the idea of being able to hit all 360 points of the circle.