I need a health bar that other people can drop into their
games. Segments, not a solid block. It has to work at any
position and any size, and it should look different when
things are going badly.
Write your requirements list before you write any code.This set also asks you to name the table and the function before you start — what is in the table, and what your function takes and does.
Notes
This one is graded on the function, not the picture. One function, called from more than one place, with a loop and a decision inside it.
How many parameters? Position, size, current health, maximum health — at least. Every measurement inside must come from them.
The segments are the loop. How many are filled is arithmetic on the health.
Going badly is the decision, and where the threshold sits is yours. Write it in the list.
Draw two bars of different sizes side by side. If one of them looks wrong, a number is hardcoded.
What Success Looks Like
One function draws the whole bar
It is called at least twice, at different positions and sizes
A loop draws the segments and a decision changes the appearance
Nothing inside the function is measured in raw pixels
Call it at size 40 and at size 400. Same bar, same proportions, no gaps and no overlap.
Submit
Your requirements list and your program folder, named cc-health-bar.