This will do exactly the same :P
Code:
SPRITE fillImage,bgImage; (size: 1x10)
max battery life = 100
min batterry life = 0
for ( int i =min batterry life ; i<=max battery life; i++)
{
//battery bar background
drawSprite(bgImage,head_x_point + (i* sprite width),head_y_point);
//actual percentage
drawSprite(fillImage,( head_x_point +( (i%getBatteryLife)*sprite width) ) ,head_y_point);
}
Another option :
Instead of 2 sprites , use a stretched quad or something.
Apply some nice filters , and voila!...