Archived

This topic is now archived and is closed to further replies.

Vulture624

Problem with bitmaps

Recommended Posts

HI I have been having problems with the bitmaps I am using in a game I am making. I have a space ship object which has 31 bitmaps displaying all of it''s different angles which it can face. I got these by making one bitmap and then using PSP to rotate it 30 times by 11.25 degrees. Where I then saved each one seperately as a .bmp file So now I''ve loaded all of the graphics into my game and stored them in a background surface. But then when I displayed the entire background surface holding the spaceship bitmaps most of the bitmaps were completely muddled. They had lost most colour, were stretched and sort lapped over the side of their area and continued back at the start of thier area. But this problem only occurs with the bitmaps that are not pointing directly forward, backward, left and right. Those ones look fine. When PSP rotated them it had to increase the size of the bitmap (which was originally 80x80 pixels) to anything up to 113x113 pixels. But this is not a problem in loading them because in the background surface each bitmap has a 120x120 area to occupy. Also if I decrease the size of any of the bitmaps back to 80x80 (which is the size of the original image pointing forward) then it will load fine. But if I do decrease it to this size then bits of the bitmap have to be cut off because it is too big otherwise. Please help

Share this post


Link to post
Share on other sites
<< But this is not a problem in loading them because in the background surface each bitmap has a 120x120 area to occupy. >>

Yeah, use your largest area when displaying any of them, also make sure your smaller bitmaps are centered in the 120 x 120 area.

Phil P

Share this post


Link to post
Share on other sites
I would calculate the largest possible image and use this size for each images.


A B
\-----------+
|-\---------|
|---\-------|
|-----\-----|
|-------\---|
|---------\-|
+-----------D C


let say that this is youre original image. The largest size of the rotated image will be at 45 degrees which means the AC line.
to get the size between A and C you simply use
size = sqrt(AD^2 + DC^2)
which in this case is sqrt(80^2 + 80^2) = 114
then make all your image 114 pixels large and 114 pixels high
then center your ship in this rectangle


[edited by - lemurion on October 7, 2003 4:47:23 PM]

Share this post


Link to post
Share on other sites
Can you post your code? I think your blitting them to the surface with the dest rect as 120x120 (which would stretch the image for the smaller sprites if I''m not mistaken). Try using the same size destination and source rect.

Share this post


Link to post
Share on other sites