float rEyeX = 220; float lEyeX = 180; float mouthX; int value; int R; int G; int B; void setup() { size (400, 400); rectMode(CENTER); mouthX= width/2; } void draw(){ //frameRate(60); background (23, 141, 255); R = 250; G = 247; B = 141; //Head stroke(0); fill(170); rect(width/2, 140, 100, 60); //Left eye stroke(0); fill(R, G, B); ellipse(lEyeX, 130, 20, 20); //Right eye stroke(0); fill(R, G, B); ellipse(rEyeX, 130, 20, 20); //Mouth stroke(0); fill(255); rect(mouthX, 155, 40, 13); //Neck stroke(0); fill(150); rect(width/2, 180, 40, 20); //Body stroke(0); fill(170); rect(width/2, 260, 100, 140); //Right arm stroke(0); fill(170); rect(290, 200, 80, 20); //right forarm stroke(0); fill(170); rect(80, 150, 20, 80); //Right hand stroke(0); fill(0); rect(80, 110, 20, 10); stroke(0); fill(255, 248, 36); rect(95, 100, 10, 30); stroke(0); fill(255, 248, 36); rect(67, 100, 10, 30); //Left hand stroke(0); fill(0); rect(320, 105, 20, 10); stroke(0); fill(255, 248, 36); rect(335, 97, 10, 30); stroke(0); fill(255, 248, 36); rect(305, 97, 10, 30); //Left arm stroke(0); fill(170); rect(110, 200, 80, 20); //Top forarm stroke(0); fill(170); rect(320, 150, 20, 80); //Red Laser noStroke(); fill(255,0,0,value); rect(rEyeX,577,15,900); rect(lEyeX,577,15,900); //building fill(80, 118, 137); rect (50, 300, 80, 200); stroke(0); fill(108, 108, 108); rect(100, 360, 100, 80); //----------- fill(80, 118, 137); rect (160, 340, 80, 200); stroke(0); fill(108, 108, 108); rect(200, 360, 100, 80); //-------------- stroke(0); fill(108, 108, 108); rect(340, 300, 100, 80); noStroke(); fill(80, 118, 137); rect (280, 300, 80, 200); fill(80, 118, 137); rect(360, 360, 100, 80); //keeping the eyes in the head if(mouseX >= 220 && mouseX <= 250) { lEyeX = mouseX - 40; rEyeX = mouseX; mouthX = mouseX-20; } if(mouseX<180 && mouseX > 150){ lEyeX = mouseX; rEyeX = mouseX + 40; mouthX = mouseX +20; } } //Laser// void mousePressed() { if (value == 0) { value = 200; } else { value = 0; } println("Destroy all humans!!"); } void mouseReleased() { if (value == 200){ value = 0; } else { value = 200; } }