• Advertisement
Sign in to follow this  

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

This topic is 4822 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Are you sure the value of HEIGHT is set correctly?

How are your sprite graphics laid out?

Share this post


Link to post
Share on other sites
Well this is not it because the feet move right but they come up on the players head[lol]

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
Sign in to follow this  

  • Advertisement