Health Bar Generator 0.1


Today, I made significant progress on the Health Bar Generator tool. I focused on optimizing the code and improving the user experience.

First, I noticed that the code had a lot of repetition, especially when getting the value of an element. To solve this, I created a helper function getElementValue(id) that takes an element's id as a parameter and returns its value. This made the code cleaner and easier to read.

Next, I tackled the issue of the vertical lines appearing in the exported health bar. This was due to the fillRect function in the loop and the fact that the width of the filled steps could be a floating-point number. To fix this, I rounded up the width of the filled rectangles to the nearest integer, which eliminated the gaps causing the vertical lines.

I also noticed that the progress slider couldn't always be set to 100%. This was because the step value of the slider was set to 100 / steps, which doesn't always result in an integer. To ensure that the user can always set the progress to 100%, I changed the step value of the slider to 1.

Finally, I added an event listener to the 'Export' button that allows the user to download their custom health bar as a PNG image. This makes it easy for users to integrate their custom health bars into their games.

Overall, I'm pleased with the progress I made today. The Health Bar Generator is becoming more user-friendly and efficient. I'm looking forward to continuing to improve this tool and making it even better for game developers.

Files

health2.zip Play in browser
Dec 26, 2023
old-version.zip 2 kB
May 04, 2023

Leave a comment

Log in with itch.io to leave a comment.