Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*
WUB WUB
By Christian Osadzuk
Move the clouds and Claptrap by moving your cursor.

*/
void setup(){
size(400,400); //Sets window size to 400x400 pixels.
}

//The code for the background, blue sky and brown earth.
void draw(){
background(130,227,234);
fill(211,217,148);
strokeWeight(0);
rect(0, 225, 400, 400);

noFill();

// The sun
fill(255,255,0);
ellipse(400,0,300,300);
fill(255,110,43,100);
ellipse(400,0,335,335);

//The mountains
fill(69,41,26);
triangle(18,225,60,160,120,225);
triangle(80,225,160,120,330,225);

// The clouds - moves as the mouse moves.
fill(255,255,255,200);
ellipse(100+mouseY,120,200,50);
ellipse(235+mouseY,70,100,25);

//The Moon, Elpis
noFill();
fill(134,150,191);
strokeWeight(1);
ellipse(40,50,100,100);
fill(99,141,191,200);
ellipse(27,34,25,25);
ellipse(60,50,25,25);
ellipse(30,65,34,34);

//The Spacestation, Helios
fill(104,104,96);
ellipse(65,73,15,15);
fill(8,191,186);
ellipse(65,73,9,9);
fill(104,104,96);
quad(50,50,70,50,50,90,30,90);
quad(82,50,102,50,82,90,62,90);
strokeWeight(2);
line(33,88,48,88);
line(50,55,65,55);
line(57,55,41,87);
line(68,88,80,88);
line(82,55,98,55);
line (89,55,74,87);

//Claptrap - Moves up and down as the cursor does.
fill(252,241,13);
quad(76,400-mouseY/2,320,400-mouseY/2,296,720-mouseY/2,100,720-mouseY/2);
fill(219,214,184);
quad(87,500-mouseY/2,310,500-mouseY/2,305,560-mouseY/2,92,560-mouseY/2);
fill(28,26,20);
quad(76,400-mouseY/2,320,400-mouseY/2,318,420-mouseY/2,78,420-mouseY/2);
fill(36,33,26);
quad(149,400-mouseY/2,250,400-mouseY/2,220,720-mouseY/2,180,720-mouseY/2);
fill(0);
quad(158,400-mouseY/2,152,240-mouseY/2,162,240-mouseY/2,170,400-mouseY/2);
fill(27,229,43,100);
ellipse(157,240-mouseY/2,30,30);
ellipse(157,240-mouseY/2,15,15);
fill(30,128,201);
ellipse(200,460-mouseY/2,80,80);
}

// Displays a message when the LMB is pressed.

void mousePressed()
{
    print(" HELLO TRAVELLER!");
}