drawPolygon(int xPoints,
int yPoints,
int nPoints)
i found this, but i dont knew how to use it. Could you help me?


1 2 3 4 5 6 7 8 9 10 | public MyWorld() { super ( 300 , 300 , 1 ); GreenfootImage img = new GreenfootImage( 300 , 300 ); img.setColor(Color.WHITE); img.fill(); img.setColor(Color.BLACK); img.drawPolygon( new int [] { 100 , 100 , 200 }, new int [] { 100 , 200 , 100 }, 3 ); setBackground(img); } |
1 2 3 | drawPolygon( int [] xPoints, int [] yPoints, int nPoints) |
1 2 3 4 | GreenfootImage image = new GreenfootImage( 100 , 100 ); int [] xPoints = new int [] { 0 , 99 , 0 }; int [] yPoints = new int [] { 99 , 99 , 0 }; image.drawPolygon(xPoints, yPoints, 3 ); |