String filenames[] = {"nuclear1.png", "nuclear2.png", "nuclear3.png", "nuclear4.png", "nuclear5.png"}; PImage images[] = new PImage[filenames.length]; void setup() { for (int i = 0; i < filenames.length; i++) { images[i] = loadImage(filenames[i]); } size(800, 800); nextchange = second(); } int picture = 0; int nextchange; void draw() { image(images[picture], 0, 0); if (second() == nextchange) { nextchange = second() + 2; // 2 is the delay if (nextchange >= 60) nextchange -= 60; picture++; if (picture >= filenames.length) picture = 0; } } void mouseClicked() { picture++; if (picture >= filenames.length) picture = 0; } void keyPressed() { //if(key == '4') // println("You pressed 4"); // (key - '0') is the number value of the digit that was pressed IF // the user pushed a digit. It's not if the user pushed a letter. if(key == '0'){ nextchange = 61; } else { nextchange = second() + 1; } }