/*truck.pde -- V2 *This version uses variables */ size(500,400); float x=width/2, y=height/2; float w=200; float h=w/2; //draw body of truck beginShape(); vertex(x, y-0.1*h); vertex(x, y-h); vertex(x+0.6*w, y-h); vertex(x+0.75*w, y-0.5*h); vertex(x+w, y-0.5*h); vertex(x+w, y-0.1*h); endShape(CLOSE); // draw the driver's window fill(255); triangle(x+0.6*w, y-0.95*h, x+0.6*w, y-0.5*h, x+0.7*w, y-0.5*h); // Draw the wheels fill(0); ellipse(x+0.25*w, y-0.1*h, 0.2*h, 0.2*h); ellipse(x+0.75*w, y-0.1*h, 0.2*h, 0.2*h);