import processing.opengl.*; float a = 600; float b = 200; float nummeans = 2; float x = 0; float y = 0; void setup() { size(800, 600, OPENGL); noStroke(); noFill(); //smooth(); hint(ENABLE_OPENGL_4X_SMOOTH); } void draw() { background(0); translate(width/2,height/2,10); stroke(255); strokeWeight(4); rectMode(CENTER); fill(0); quad(100-y,-150,300-y,-150,300-y,150,100-y,150); line(100-y,-150,300-y,150); quad(-100,-150,100,-150,100,150,-100,150); line(-100,-150,100,150); quad(-300+x,-150,-100+x,-150,-100+x,150,-300+x,150); line(-300+x,-150,-100+x,150); stroke(0,255,0); line(-300+x,-150,-100+x,(1.5*x)-150); stroke(0,0,255); line(-100+x,(1.5*x)-150,100,(1.5*y)-150); stroke(255,0,0); line(-300+x,-150,300-y,0); } void keyPressed() { if (key == CODED) { if (keyCode == UP) { x = x+1; } else if (keyCode == DOWN) { x = x-1; } else if (keyCode == RIGHT) { y = y+1; } else if (keyCode == LEFT) { y = y -1; } else if (keyCode == SHIFT){ x = 0; y = 0; } } }