int x1 = 175; int y1 = 175; void setup(){ size(400, 400); // size of the window background(0, 0, 0); //background color frameRate(30); } void draw() { //background(0, 0, 0); // comment this out for snake fill(0, 255, 0); rect(x1, y1, 10, 10); } void keyPressed(){ if (keyCode == UP) { y1= y1-10; } if (keyCode == DOWN) { y1= y1+10; } if (keyCode == RIGHT) { x1= x1+10; } if (keyCode == LEFT) { x1= x1-10; } }