Getting position of rotated bitmap

Hey, rrybody

Im just trying to simulate a tank kinda thing and ive ran into another problem. Im trying to get the position of the barrel of the tank no matter how its rotated.
This is my code for getting the barrels position currently
1
2
test[cur].x = TankX+32 * cos(TankRotation * ALLEGRO_PI/180);
test[cur].y = TankY-6 * sin(TankRotation * ALLEGRO_PI/180);

test is the bullet class and cur is the next available open object.

http://i.imgur.com/lfhFz.png
http://i.imgur.com/tOUH6.png

Also, ignore the sexiness of my tank
What is 32 and 6?

For a given turrnent length len, and origin (position of the center or the turrent), (x, y), the end of the barrel will be:
(x + len*cos(angle), y + len*sin(angle)) where angle is the angle of the turrent in radians.
Topic archived. No new replies allowed.