Lights Out (one liner)

Have you ever had the feeling that someone is following you? Well in this situation, you’d be correct. In the distance, you see a curtain that appears to be floating in midair flying towards you! Don’t let it catch you, or you won’t be able to see where you’re going. The curtain is relentless. Don’t look away, or you might find yourself in darkness!

 

//Lights out
// If the circle catches your cursor, it will turn out the lights

float buttonX = width/2;
float buttonY = height/2;

void setup(){
size(400,400);
background(255);
frameRate(140);
smooth();

}

void draw(){
float vChase = 1;
float rad = 10;
background(255,10);

stroke(0);
ellipse(buttonX, buttonY, rad, rad);

if(buttonX == mouseX && buttonY == mouseY){

background(0);
println("done");
}

if (buttonX > mouseX){
buttonX -= vChase;
println("minus X");
}

if (buttonX < mouseX){
buttonX += vChase;
println("plus X");

}

if (buttonY > mouseY){
buttonY -= vChase;
println("minus Y");
}

if (buttonY < mouseY){
buttonY += vChase;
println("plus Y");

}

}

Comments are closed.