class Street { float x = width/2; float y = height/2; int roadWidth = 16; color street = color(255, 255, 255); color roadBorder = color(155, 142, 117); Street() { } void move(float mx, float my) { x = mx; y = my; } void display(String dir, float len, String txt) { fill(street); stroke(roadBorder); // Horizontal street if (dir == "h") { rect(-1, y-roadWidth/2, len, roadWidth); // cover spot where streets meet noStroke(); rect(-1, y-roadWidth/2+1, len, roadWidth-1); } else { // Vertical street rect(x-roadWidth/2, -1, roadWidth, len); // cover spot where streets meet noStroke(); rect(x-roadWidth/2, y-roadWidth/2+1, roadWidth+1,roadWidth-1); } fill(0); if (dir == "h") // Show horizontal text { text(txt, 45, y); } else // Show vertical text { translate(width/2, height/2); rotate(PI/2.0); textAlign(LEFT, CENTER); text(txt, -205, -x+299); } } }