Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int radio = 60;
- int cont = 0;
- boolean justonce = false;
- void setup(){
- size(200, 200);
- stroke(0);
- }
- boolean overRect = false;
- void draw(){
- background(255);//Fondo de color blanco
- translate(width/2,height/2);
- if(mouseX > (width/2)-radio && mouseX < (width/2)+radio && mouseY > (height/2)-radio && mouseY < (height/2)+radio){
- overRect=true;
- }
- else{
- overRect=false;
- }
- if(cont != 5){
- fill(200);
- }
- else{
- fill(100,251,102);
- }
- rectMode(RADIUS);
- rect(0,0,radio,radio);
- }
- void mousePressed(){
- println(justonce + " " + overRect);
- if (overRect==true && justonce == false){
- cont++;
- justonce = true;
- println(cont);
- }
- }
- void mouseReleased(){
- justonce = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement