Flixel Power Tools FlxBar

Back to the Flixel Power Tools

Released in version 1.7

Note: This class replaces the old FlxHealthBar class.

FlxBar started life as a way to display the health of a sprite. In version 1.7 it grew up and became a lot more versatile! It can now be used as a general purpose bar. Be that a progress bar, loading indicator, time delay or health bar.

You can have it track any value on a parent sprite and update automatically. For example if you link the bar to the health value of a sprite, and the sprite gets hurt, it will update to reflect this. It can automatically follow the parent sprite around like a little floating bar over players / enemies heads. Or it can be placed into a HUD.

This class provides a really fast way to create them, and they are highly customisable. You can have a plain-colour filled bar (supporting alpha levels), a gradient-filled bar or an image filled bar. The bar can fill in one of 8 different directions.

Screen Shot

Code Example

Recent Flixel Power Tool Posts

  1. Flixel Power Tools v1.9 Released
  2. Flixel Power Tools v1.8 Released - Let's get clicky
  3. Flixel Power Tools v1.7 - Kaboom!
  4. Flixel Power Tools v1.6 released including FlxControl
  5. Flixel Power Tools v1.5 - A monster of an update!
  6. FlxScreenGrab and FlxScrollZone added to Flixel Power Tools
  7. Flixel Power Tools v1.3 - Now Flixel 2.5 compatible!
  8. FlxHealthBar added to Flixel Power Tools

3 Responses

Leave a comment
  • Victor Grunn
    January 14th 2012 at 10:07 am

    I know you’re focusing more on html5 nowadays, but a quick question on this.

    Is there any easy way to recycle these in Flixel? I’m working with a game that requires a whole lot of enemies onscreen, and for a lot of them I’d like to be using FlxBar – I get the impression memory would be more manageable if I recycled these, but if there’s a straightforward way to do it, I’m not seeing it.

    Thanks.

  • Kronoshifter
    March 23rd 2012 at 11:49 pm

    I would say it would be as simple as reinitializing it with a new parent/value. Haven’t taken a look at the class yet though, so I wouldn’t know if that could be done.

  • jaypeekay
    November 13th 2013 at 6:53 pm

    How do you set the color of those bars?

Make yourself heard