Im making a hp bar, but i want my hp bar to be curved like an arc instead of a rectangle. so i did it like so
im like 100% sure that that's probably not the correct way of doing it but i can't find anything that lets me draw an arc like this with the thickness.
I tried bar.drawShape(new Arc2D.Double(n, n, width-2*n, height-2*n, startAngle, - arcLength, Arc2D.PIE));
and then filling a smaller arc with "invisible" color but i realized invisible color just means u still see the previous arc xD
link to my scenerial that i currently use this for
http://www.greenfoot.org/scenarios/11459
public CurvedBar(int width, int height, int thickness, int startAngle, int arcLength, Player p, int resource)//IMPORTANT, length goes clockwise!!!, resource is the resource this bar is displaying
{
this.width = width;
this.height = height;
this.p = p;
maxValue = p.getResource(resource);
this.thickness = thickness;
this.arcLength = arcLength;
this.startAngle = startAngle;
this.resource = resource;
if(resource == 1)
{
c = Color.GREEN;
}
else
{
c = Color.CYAN;
}
bar = new GreenfootImage(width, height);
bar.setColor(Color.GRAY);//value color
for(int n = 0; n < thickness; n ++)
{
bar.drawShape(new Arc2D.Double(n, n, width-2*n, height-2*n, startAngle, - arcLength, Arc2D.OPEN));
}
setImage(bar);
}

