float radijus = 30; float xc; float xbrzina = 2; int xsmer = 1; void setup() { size(640, 360); stroke(0); frameRate(30); strokeWeight(2); ellipseMode(RADIUS); noFill(); xc = width / 3; } void robot(int x, int y, int l) { ellipseMode(RADIUS); strokeWeight(2); fill(255); //glava rect(x, y, l, 2*l/3); //antena noFill(); beginShape(); vertex(x + l/2, y); vertex(x + l/2 + l/16, y - l/8); vertex(x + l/2 - l/16, y - l/8); vertex(x + l/2, y - l/4); endShape(); fill(255, 0, 0); ellipse(x + l/2, y - l/4, l/24, l/24); fill(255); //oči ellipse(x + l/4, y + 2*l/9, l/10, l/10); ellipse(x + 3*l/4, y + 2*l/9, l/10, l/10); fill(0); ellipse(x + l/4 + l/24, y + 2*l/9 + l/24, l/24, l/24); ellipse(x + 3*l/4 - l/24, y + 2*l/9, l/24, l/24); fill(255); //usta rect(x + l/3, y + 9*l/24, l/3, 2*l/9); //vrat rect(x + l/2 - l/8, y + 2*l/3, l/4, l/16); rect(x + l/2 - l/16, y + 2*l/3 + l/16, l/8, l/16); rect(x + l/2 - l/8, y + 2*l/3 + l/8, l/4, l/16); //točak fill(0); ellipse(x + l/2, y + 4*l/6 + l, l/3, l/3); //trup fill(255); rect(x - l/8, y + 5*l/6, l + l/4, l); //baterija fill(255,0, 0); rect(x + l/8, y + 7*l/6, l/8, l/3); noFill(); rect(x + l/8, y + 7*l/6, 3*l/4 - l/16, l/3); fill(0); rect(x + l/8 + 3*l/4 - l/16, y + 7*l/6 + l/9, l/16, l/9); } void draw() { background(220); xc = xc + xbrzina * xsmer; if (xc > width + 12) xc = - 124; robot(int(xc), 100, 96); }