Its actually quite easy to do.
For your enemies you add 2 variables:
Max_health (Just hold the max health the enemy can have)
Current_health (Enemy current health)
Then you make a sprite to indicate the health bar. You can use whatever width you want.
have to be the same, so you can either add that as an variable to the healthbar it self, would probably be the best, or you can hardcode it or add it as a global whatever way you prefer doing it.
Then use the following math to control it.
Width_of_enemy_health_bar = int((Width_of_enemy_health_bar_start_width / Enemy_Max_health) * Enemy_current_health)
So it looks like this:
Width_of_enemy_healthbar = 100px
Enemy max health = 20
Enemy_current_health = 14
Width_of_enemy_healthbar = int(100 / 20) * 14) = 70 px
Width_of_enemy_healthbar = int(100 / 20) * 8) = 40 px