How do I draw a triangle Pixel by pixel? I'm trying to copy the flag of the Bahamas, but I can't figure the triangle out.
   
   
            GreenfootImage bg = getBackground();
for(int x = ___; x<=___; x++)
{
for(int y = ___; y<= ___; y++)
{
bg.setColorAt(x, y, COLOR);
}
}int h = bg.getHeight(); // height of image to place triangle on (base length of triangle) int w = (int)(Math.sqrt(3) * h / 2); // width of triangle with a vertical left side (altitude of triangle)
for (int y = 0; y < h; y++)
{
    for (int x = 0; x < w; x++)
    {if (Math.abs(y - h / 2) * w < (w - x) * h / 2)
public MyWorld()
{
    super(800, 400, 1);
    GreenfootImage bg = getBackground();
    int h = bg.getHeight();
    int w = (int)(Math.sqrt(3) * h / 2);
    // add striping here
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            if (Math.abs(y - h / 2) * w < (w - x) * h / 2)
                bg.setColorAt(x, y, Color.BLACK);
            }
        }
    }
}