Jump to content
  • Advertisement
Sign in to follow this  
Hermes

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

This topic is 5120 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
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.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!