ICC
< back to sketch

int x,y;

void setup(){
size(300,300);
}

void loop(){

background(255,255,255);
rect(x,y,20,20);
if(x >150){
background(100,200,10);
}
if(y >150){
background(0,10,mouseX);
}
rect(x,y,20,20);

}

void keyPressed(){

if(key == UP){
y = y-1;
}
if(key == DOWN){
y = y+1;
}
if(key == LEFT){
x = x-1;
}
if(key == RIGHT){
x = x+1;
}
}

< back to sketch