I can compile it but it doesn't work for me.
Anyways who the hell made a function that can't take variables or demicals in its arguments

.
But said that, I thought to look around in the forum and see if anyone else had that problem and how they got it solved. What I saw was that they create a bitmap that has a full part and an empty part. So when the health decreases the bitmap is being moved from full part to empty part.
Basically the topic here:
Healthbar thingyIt seems there is no actual way to cut the sprite? :S. Would be better just to keep the bitmap sizes under control...