Search code examples
javagame-enginescenebuilder

How can I design a progress bar in SceneBuilder?


Here a simple question I'd like to ask. I'm making a videogame (with NO graphics) and for that I'm using SceneBuilder. So here is the state of my HP bar : HP BAR

Now I want to reshape it in order to obtain a heartshape : HP BAR wanted

Thus, anyone know if it's possible to do it using SceneBuilder with the settings?

Thank you everyone, have a wonderful day.


Solution

  • One simple way, providing the background of the panel is simple, would be to overlay an ImageView over the top of the progress bar. If you use a PNG with a "hole" of transparency, you'd effectively hide the areas of the square that you're not interested in seeing.

    heart

    In this example, the black pixels would be the same colour as the background colour (in your case grey) and the white pixels would be fully transparent.

    The downside to this is that if the panel changes colour then you'll need to recreate your PNG in the new colour.