//i,j,k,m int dx,dy; int x,y; boolean shaking; void setup() { size(300,300); background(50,50,50); stroke(0,0,0); fill(50,50,50,5); x=width/2; y=height/2; shaking=false; } void draw() { if (shaking) { rect(0,0,width,height); //println("SHAKEN"); } line(x,y,x+dx,y+dy); x+=dx; y+=dy; x=min(width,max(0,x)); y=min(height,max(0,y)); } void keyPressed() { switch (key) { case 'm': dy=1; break; case 'i': dy=-1; break; case 'k': dx=1; break; case 'j': dx=-1; break; case 's': shaking=true; break; } } void keyReleased() { switch (key) { case 'i': case 'm': dy=0; break; case 'j': case 'k': dx=0; break; case 's': shaking=false; break; } }