This site requires JavaScript, please enable it in your browser!
Greenfoot back
vmcalister81@yahoo.com
vmcalister81@yahoo.com wrote ...

2015/7/24

need help with constructor error

public class ColorTest extends World { /** * Constructor for objects of class ColorTest. * */ public ColorTest() { // Create a new world with 400x400 cells with a cell size of 1x1 pixels. super(400, 400, 1); boolean black = true; for (int x = 0; x <8 ; x++) { if(black) //alternate colors at the start of each column black = false; else black = true; for (int y = 0; y < 8; y++) { if(black) //alternate the colors { ColorPatch blackSquare = new ColorPatch(0,0,0); addObject(blackSquare, x*50 + 25, y*50 + 25); black = false; } else { ColorPatch redSquare = new ColorPatch(255,0,0); addObject(redSquare, x*50 + 25, y *50 + 25); black = true; } } } } }
davmac davmac

2015/7/24

#
Please read (this) and (this).
Thanks
You need to login to post a reply.