// Example 05-21 from "Getting Started with Processing" // by Reas & Fry. O'Reilly / Make 2010 int x = 215; int y = 45; void setup() { size(480, 480); } void draw() { if (keyPressed && (key == CODED)) { // If it's a coded key if (keyCode == LEFT) { // If it's the left arrow x--; } else if (keyCode == RIGHT) { // If it's the right arrow x++; } else if (keyCode == UP) { y--; } else if (keyCode == DOWN) { y++; } } rect(x, y, 50, 50); }