I know how to add a trailer behind a missile, but I am having trouble getting the right coordinates, the trailer is a bit off.
So, first, I rotate the image so it is facing the target and render it:
1 2 3 4
| float rotation = (float) getAngle(x, y, targetX, targetY); g.rotate(x, y, rotation + 90); g.drawImage(missile, x, y); |
Then, I try to render the trailer behind the missile like this:
1 2 3 4 5
| if(trailer != null) { g.rotate(x, y + realHeight, rotation + 90); stage.append(trailer.getClone(x, y + realHeight)); } |
And finally, I make the rotation normal:
g.rotate(0, 0, 0);
Obviously this doesn't work.
Any one have any idea?