void setup() { size(800,600); background(255,255,255); smooth(); frameRate(20); } int x=100; int y=50; int x2=200; int y2=100; int xp=350; int yp=350; void draw() { background(255); if(keyPressed) { if(key=='h') { xp = xp-2; } if(key=='u') { yp = yp-2; } } player(xp,yp); roundbot(x,y); x = x+10; if(x>800) { x = 0; } squarebot(x2,y2); y2 = y2+10; if(y2>600) { y2 = 0;} } void roundbot(int x,int y) { strokeWeight(5); fill(200,200,200); stroke(0,0,0); ellipse(50+x,120+y,100,200); ellipse(50+x,20+y,100,40); ellipse(30+x,220+y,40,40); ellipse(70+x,220+y,40,40); } void squarebot(int x,int y) { strokeWeight(5); stroke(0,0,0); fill(128,0,0); rect(0+x,0+y,60,60); rect(20+x,60+y,20,20); fill(255,192,0); rect(0+x,80+y,60,100); fill(0,0,0); rect(-10+x,170+y,30,30); rect(40+x,170+y,30,30); } void player(int x,int y) { strokeWeight(1); stroke(0,0,0); fill(250,200,150); ellipse(20+x,20+y,15,20); fill(0,0,255); rect(10+x,30+y,20,25); rect(5+x,30+y,6,30); rect(29+x,30+y,6,30); fill(0,0,100); rect(11+x,55+y,9,25); rect(20+x,55+y,9,25); } |