Jump to content
  • Advertisement

Archived

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

VanVan

cannot clip the NPC

This topic is 6244 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

Sorry, can anyone tell me that i can only clip the bottom side of tile while i move the tile down, but i cannot clip the top side of tile while i move the tile up thanks regard!!! //*** D key if (GetAsyncKeyState(0x44)) { SPosY += 1; } //*** E key if (GetAsyncKeyState(0x45)) { SPosY -= 1; } RECT rcSrc {0, 0, 32, 32 //If this tile is off the top of the screen... if (SPosY < 0) { rcSrc.top -= SPosY; } //If this tile is off the bottom of the screen... if ((SPRITE_DIAMETER + SPosY ) > SCREEN_HEIGHT) rcSrc.bottom -= SPosY + SPRITE_DIAMETER - SCREEN_HEIGHT; g_pDisplay->Blt( SPosX,SPosY, g_pAnimationSurface, &rcSrc);

Share this post


Link to post
Share on other sites
Advertisement
My guess is that the error lies in this line...

g_pDisplay->Blt( SPosX,SPosY, g_pAnimationSurface, &rcSrc);


when the bitmap goes off the top, SPosY is negative. It should probably be clamped to zero, or something like that.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!