PImage up; PImage down; PImage left; PImage right; PImage current; // position float x, y; void setup() { size(200, 200); up = loadImage("arrow_up.png"); down = loadImage("arrow_down.png"); left = loadImage("arrow_left.png"); right = loadImage("arrow_right.png"); current = up; x = width/2; y = height/2; } void draw() { background(240); image(current, x, y); //, 64, 64); if (keyPressed) { if (key == CODED) { if (keyCode == UP) { current = up; y = y - 2; } if (keyCode == DOWN) { current = down; y = y + 2; } if (keyCode == RIGHT) { current = right; x = x + 2; } if (keyCode == LEFT) { current = left; x = x - 2; } } } }