this is a graphics/math problem. Consider this 2 sprite / surface
As you can see they are a tank and his gun turret. Now, i manage the turret rotation, and it works, and, also, the rotation of the tank on the screen.
What it'snt work is the correct "blitting" of the turret on my tank.
The problem is that the turret is never blitted correctly on the tank. This is a math problem, and i'm not so good in math ! How can i correct blit the turret centered on the "right" hole of my tank sprite ?
I'm using c# and sdl.net and actually i blit the turret with this code ( 13,13 are the X and Y position of the 'black' hole of the tank, but, i know, this is not the right method to blit it!):
Surface tmpsurf = new Surface("graphics/tank_turret_long.png"); Surface turretSurf = tmpsurf.CreateRotatedSurface(cannonangle); turretSurf.Transparent = true; turretSurf.TransparentColor = Color.Black; Point posTurret = new Point(13+this.X,13+this.Y); Video.Screen.Blit(torrettaSurf,posTorretta);
Thank in advance