Jump to content
  • Advertisement
Sign in to follow this  
bobFritzelpuff

XNA Sprite Issues

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

I'm trying to create a health bar for a game. The health bar is asymmetric, and thus, can not be simply scaled to the percentage of health remaining. However, changing the source rectangle of the sprite leads to a choppy health bar, as the health bar image is a low enough resolution that shrinking the source rectangle pixel-by-pixel causes noticeable jumps. How is this usually done?

Share this post


Link to post
Share on other sites
Advertisement
There's not really a "right" way to do it. In your case, though, you might want to think about splitting up your health bar into small "chunks" that you can remove based on the current health percentage -- that way you won't have to scale the image and you can still increase/decrease the health as-needed. The chunks don't have to be large, either, you can make the slices as small/big as you need to.

Share this post


Link to post
Share on other sites
Basically, I have a bar with a rounded edge. I'd like to be able to make a top percentage translucent (alpha value of 255) and a bottom percentage tinted to a certain color, and I would like precision higher than the number of pixels in the height of my image. Is this possible?

Alternatively, is it possible to scale and color a single pixel to exactly the right height and color, and then 'apply' that scaled image to my rounded bar to give it the rounded ends?

Or do I have to settle for the low-resolution bar growth?

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.

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!