- // GhostRave by Hannah McIntear
- //When the mouse is moved up and down the ghost moves and the dance floor flashes
- //When the mouse is moved left and right the lasers wave around the screen
- //Move the mouse in a circle for the best effect!
-
-
- void setup() {
- //Set the size of window
- size(400,400);
- smooth();
- //Set frame rate to 30
- frameRate(30);
- }
-
- void draw() {
- //Draws the background
- background(0);
- strokeWeight(10);
-
- //Dance floor squares
- //Green & purple squares
- fill(255,77,225);
- stroke(1);
- //Top left
- fill(255,77,225);
- quad(-10,200,100,200,87,250,-10,250);
-
- //Top left alt color
- fill(107,255,88, mouseY/(width*0.5)*255);
- quad(-10,200,100,200,87,250,-10,250);
-
- //Top middle right
- fill(255,77,225);
- quad(200,200, 300,200, 313,250, 200,250);
-
- //Top middle right alt color
- fill(107,255,88, mouseY/(width*0.5)*255);
- quad(200,200, 300,200, 313,250, 200,250);
-
- //Middle middle left
- fill(255,77,225);
- quad(87,250, 200,250, 200,325, 69,325);
-
- //Middle middle left alt color
- fill(107,255,88, mouseY/(width*0.5)*255);
- quad(87,250, 200,250, 200,325, 69,325);
-
- //Middle right
- fill(255,77,225);
- quad(313,250,410,250, 410, 325, 331,325);
-
- //Middle right alt color
- fill(107,255,88, mouseY/(width*0.5)*255);
- quad(313,250,410,250, 410, 325, 331,325);
-
- //Bottom left
- fill(255,77,225);
- quad(-10, 325, 69,325, 50,400, -10,400);
-
- //Bottom left alt color
- fill(107,255,88, mouseY/(width*0.5)*255);
- quad(-10, 325, 69,325, 50,400, -10,400);
-
- //Bottom middle right
- fill(255,77,225);
- quad(200,325,331,325,350,400,200,400);
-
- //Bottom middle right alt color
- fill(107,255,88, mouseY/(width*0.5)*255);
- quad(200,325,331,325,350,400,200,400);
-
- //Blue & red squares
- //Top middle left
- fill(63,255,252);
- quad(100,200,200,200,200,250,87,250);
-
- //Top middle left alt color
- fill(210,48,31, mouseY/(width*0.5)*255);
- quad(100,200,200,200,200,250,87,250);
-
- //Top right
- fill(63,255,252);
- quad(300,200, 410,200, 410,250,313,250);
-
- //Top right alt color
- fill(210,48,31, mouseY/(width*0.5)*255);
- quad(300,200, 410,200, 410,250,313,250);
-
- //Middle left
- fill(63,255,252);
- quad(-10, 250, 87,250, 69,325, -10,325);
-
- //Middle left alt color
- fill(210,48,31, mouseY/(width*0.5)*255);
- quad(-10, 250, 87,250, 69,325, -10,325);
-
- //Middle middle right
- fill(63,255,252);
- quad(200,250,313,250,331,325,200,325);
-
- //Middle middle right alt color
- fill(210,48,31, mouseY/(width*0.5)*255);
- quad(200,250,313,250,331,325,200,325);
-
- //Bottom middle left
- fill(63,255,252);
- quad (69,325, 200,325, 200,400, 50,400);
-
- //Bottom middle left alt color
- fill(210,48,31, mouseY/(width*0.5)*255);
- quad (69,325, 200,325, 200,400, 50,400);
-
- //Bottom right
- fill(63,255,252);
- quad(331,325,410,325,410,400, 350,400);
-
- //Bottom right alt color
- fill(210,48,31, mouseY/(width*0.5)*255);
- quad(331,325,410,325,410,400, 350,400);
-
- //Ghost's Shadow
- noStroke();
- fill(175,150);
- ellipse(200, mouseY+height/2, mouseY-1,20);
-
- //Lasers that go behind Ghost
- strokeWeight(4);
- stroke(random(255), random(255), random(255), 200);
- line(30,60, mouseX+20, 410);
- line(370,60,mouseX+1,410);
-
- //Ghost
- noStroke();
-
- //Ghost's head
- fill(255);
- ellipse(200,mouseY,100,100);
-
- //Ghost's body
- rect(150, mouseY, 100,75);
-
- //Ghost legs
- triangle(150,mouseY+75,175,mouseY+75,162.5,mouseY+100);
- triangle(175,mouseY+75, 200,mouseY+75, 187.5,mouseY+100);
- triangle(200, mouseY+75, 225,mouseY+75, 212.5,mouseY+100);
- triangle(225, mouseY+75, 250, mouseY+75, 237.5,mouseY+100);
-
- //Ghost's eyes
- fill(0);
- ellipse(180, mouseY, 10,15);
- ellipse(220,mouseY,10,15);
-
- //Lights
- fill(255,150);
- triangle(50,20,70,60,30,60);
- triangle(350,20,370,60,330,60);
-
- //Lasers that go in front of Ghost
- strokeWeight(4);
- stroke(random(255), random(255), random(255), 200);
- line(68,60,mouseX/2,410);
- line(49,60,mouseX+350,410);
- line(330,60,mouseX*2,410);
- line(350,60,mouseX+300,410);
-
- }
-