Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
// First Contact

// You are in a space ship to Mars!
// A random alien popped up at the window and it is looking at your cake.
// Move mouse left and right to move your cake.
// Move mouse up and down to close/open your window.
// Have fun !


// setting back ground up
void setup(){
  size(400, 400);
  rectMode(CENTER);
  ellipseMode(CORNERS);
  noStroke();
}




void draw(){
  /* spaceship wall */
  fill(110);
  rect(200,200,400,400);
  
  
  
  /* outside background */
  
  //background color
  ellipseMode(CENTER);
  fill(0,163,136);
  noStroke();
  ellipse(200,180,280,280);
  
  //background stars
  fill(255,255,157);
  ellipse(110,200,20,20);
  ellipse(290,130,55,55);  
  ellipse(150,80,60,60);
  
  
  
  /* alien */
  
  //body
  strokeWeight(5);
  fill(255,97,56);
  stroke(190,235,159);
  rect(200,220,120,200);
  
  //eyes
  fill(255);
  strokeWeight(2);
  stroke(0);
  ellipse(170,170,30,30);
  ellipse(230,170,30,30);
  
  //moveble eyeballs
  fill(0);
  noStroke();
  ellipse((mouseX*0.020)+167,177,15,15);
  ellipse((mouseX*0.020)+226,177,15,15);
  
  //mouth
  fill(139,0,0);
  noStroke();
  rect(200,220,40,20);
  fill(255);
  rect(200,216,15,12);
  
  //Saliva
  fill(135,206,250);
  rect(213,227,18,8);
  rect(215,235,8,20);



  /* window */
  
 //window gates
  fill(110);
  noStroke();
  rect(200,(mouseY)+200,400,400);
  
  //window frame
  noFill();
  stroke(230);
  strokeWeight(20);
  ellipse(200,180,340,340);
  ellipse(200,180,290,290);
  
    
  
  /* cake */
  fill(240,128,128);
  noStroke();
  rect(mouseX,300,80,20);
  
  fill(255,235,205);
  rect(mouseX,330,80,40);
  
  fill(178,34,34);
  rect(mouseX,320,80,10);
  rect(mouseX,335,80,10);
  
  fill(178,34,34);
  rect(mouseX,283,15,15);
  
  

  /* shadow */
  
  //wall shadow top
  noStroke();
  strokeWeight(0);
  fill(0,0,0,150);
  rect(200,10,400,72);
  
  //wall shadow bottom
  rect(200,(mouseY)+246,400,400);  
}