I made a fuel bar that is supposed to be vertical and slowly decreasing. But the issue here is that it decreases from bottom to top. How do I go about flipping that
import greenfoot.*;
public class FuelAmount extends Actor
{
private static int fuelcounter=5;
private static int fuelwidth=10;
private static int fuelheight=100;
private static int pixelperfuel=(int)fuelheight/fuelcounter;
public FuelAmount()
{
update();
}
public void act()
{
update();
//setImage(new GreenfootImage("Fuel Tank:"+getfuel(),32,Color.RED,new Color(0,0,0,0)));
}
public void update()
{
setImage(new GreenfootImage(fuelwidth,fuelheight));
GreenfootImage myImage=getImage();
myImage.setColor(Color.WHITE);
myImage.drawRect(0,0,fuelwidth+1,fuelheight+1);
myImage.setColor(Color.RED);
myImage.fillRect(1,1,fuelwidth,fuelcounter*pixelperfuel);
}
public static int getfuel(){
return fuelcounter;
}
public static void setfuel(int fc){
fuelcounter=fc;
}
}