What's wrong with this piece of code?????
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
RECT rPortion = {0, HEIGHT * currentFrame, WIDTH, HEIGHT * currentFrame + HEIGHT};
The four members of a RECT are left, top, right and bottom - the last two are not width and height.
The four members of a RECT are left, top, right and bottom - the last two are not width and height.
Well i changed the code to this:
but the problem still exists.....what is that makes this funny thing happen in my sprte animation
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
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
Regards,
Lief Jorgensen
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement