View Full Version : Irregularly-shaped health bar?
09-25-2010, 06:26 PM
Working through the "No Experience Needed" HUD series (great stuff), but I've come across a snag: He uses, as I'm sure most do, a regular rectangular bar. Unfortunately, the HUD design my team's come up with features irregular shapes. This leaves me wondering at an alternative to the standard scaling to represent health/armor/ammo.
I was thinking I might be able to do something with masking?
Anyways, here's the shape that I'm working with. The red is health, blue is armor. The large one is for yourself, the others for your squadmates.
healthbar pic (http://img215.imageshack.us/f/healthbar.png/)
09-25-2010, 11:08 PM
Masking is definately the way to go here. And then you can just scale it to represent the loss of health (either horizontally or vertically).
09-26-2010, 12:15 AM
That was my initial thought. However, I took a look at Mr. Doyle's best practices post and saw that masks are expensive. What I ended up doing was setting the scaling center (registration in Flash) of the shape to the horizontal middle, vertical bottom.
Then, as I scale it in X and Y, it will basically shrink in on itself. If this isn't intuitively readable in game, I'll go with masking.
thanks for the response.
09-27-2010, 10:37 AM
In the case of irregular shapes, you could also go with image sequences in Flash instead of animating the shape.
10-03-2010, 02:14 PM
Hey Matt, I had considered doing that, where basically I would create a new keyframe for each health percentage, and just set the frame based on the current health percentage. However, I was under the impression that would bloat the size of the .swf.
Was I under the wrong impression?
10-03-2010, 03:17 PM
The use of masks is minimal in terms of impacting performance and even file size. Using a blended mask (soft) would add to it some, but still it isn't going to have a huge impact. Definitely not enough to rule out using it.
You can either scale the mask or move it across keyframes or script its position. I prefer scripting it based on the health percentage.
10-04-2010, 12:39 PM
Yes - image sequences will impact file size & memory. Use them sparingly. Masks will affect performance. They are expensive. Use them sparingly.
10-04-2010, 05:36 PM
If it were up to me, I'd try to get away with using masks over multiple bitmaps to achieve what you're wanting to achieve, FlowState. But then again, I'm an artist in the game industry and I strive to get the best look in the end, even if it means hogging a bit more resources. Programmers, as you can probably imagine, hate me.
Seriously though, if there's an engineer/programmer/scripter you can talk with about this and see what your limitations are on memory and CPU usage, I'd do that before slapping masks all over the place. Once you get an idea of what your limitations are, you can plan accordingly. If you're early in on a project and have no idea what your limitations will be yet, since optimization is one of those things that generally takes place towards the end of a project, I'd try the masking method first. You can always go back and try the bitmap method later if you need to.
Personally, I'd rather use masks over bitmaps. As an artist, you have a lot more control over fine tuning the animation and making the meter animations look sleek.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.