Sign in to follow this  
Hermes

What's wrong with this piece of code?????

Recommended Posts

RECT rPortion={0,HEIGHT*currentFrame,WIDTH,HEIGHT}; TransparentBlt(hdcBack,posX,posY,WIDTH,HEIGHT,hdcBitmap,rPortion.left,rPortion.top,rPortion.right,rPortion.bottom,RGB(0,0,0)); the bitmap is cut and the piece of the image that was cut is seen at the top of the bitmap(the feet appear on the caracter's head) Thanks for your help

Share this post


Link to post
Share on other sites
Well i changed the code to this:

void CMonster::DisplayBitmap()
{



hOldBitmap=(HBITMAP)SelectObject(hdcBitmap,hBitmap);



RECT rPortion={0,HEIGHT*currentFrame,WIDTH,HEIGHT*currentFrame+HEIGHT};


TransparentBlt(hdcBack,posX,posY,WIDTH,HEIGHT,hdcBitmap,rPortion.left,rPortion.top,rPortion.right-rPortion.left,rPortion.bottom-rPortion.top,RGB(0,0,0));



SelectObject(hdcBitmap,hOldBitmap);


}








but the problem still exists.....what is that makes this funny thing happen in my sprte animation

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You need to post your code to find the posx and posy values, that is where the problem is. PosX and PosY are the location which you want to draw the sprite at, have you offset these by the height of the body? (PosX might not need to change, but PosY would probably have to increase)

Regards,

Lief Jorgensen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this