float x = 300; // current position float y = 300; // current position float r = 50; // current radius int strength = 5; // tickling strength boolean won = false; // whether or not we won void setup() { size(400,400); smooth(); noStroke(); textFont(loadFont("Helvetica-24.vlw")); textAlign(CENTER); } void draw() { // only continue if we did not win if(!won) { background(0); // check if we are inside the ellipse if(dist(mouseX,mouseY,x,y) <= r) { // tickle x = random(x-strength,x+strength); y = random(y-strength,y+strength); } // Set size from how far mouse has moved fill(255); ellipse(x,y,r*2,r*2); // draw the center fill(128); ellipse(width/2,height/2,5,5); // check if I won won = dist(x,y,width/2,height/2) <= r; // print a message if I won if(won) { fill(255,0,0); text("You got it in "+frameCount+" frames!",width/2,height/2); } } } void keyPressed() { // restart in different positions if(key == 'a') { x= 300; y = 300; won = false; frameCount = 0; } else if(key == 'b') { x= 100; y = 300; won = false; frameCount = 0; } else if(key == 'c') { x= 300; y = 100; won = false;frameCount = 0; } else if(key == 'd') { x= 100; y = 100; won = false; frameCount = 0; } else if(key == 'w') { x = width/2; y = height/2; } // if you cannot make it } // START NO NOTES // code used to capture screenshots void keyReleased() { if(key == '`' && !online) save("sketch.png"); }