> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.AeALCuLYdOX/rev.12145
 * 
 * authors: 
 *   Lexisaurus
 *   
 *   Jacey
 *   Lexisaurus

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



int value = 0;
int snowx = 250;
int snowy = 0;
int santax = 150;
int santay = 250;
int value2 = 0;
int counter;
int piece = 390;


void setup()
{
    size(500,500);
    background(#CCFFFF);
    strokeWeight(15);
    stroke(255);
    frameRate(5);
    counter = 0;
}

void draw()
{
    
    background(#CCFFFF);
    //lights
    //string
    strokeWeight(2);
    stroke(0);
    line(10,0,320,57);
    line(320,57,500,24);
    //bulbs
    strokeWeight(10);
     stroke(0);
    if(counter %2 == 0)
    {
        stroke(#00CC00);
        point(10,0);
        point(30,4);
        point(50,8);
        point(70,12);
        point(90,16);
        point(110,20);
        point(130,24);
        point(150,28);
        point(170,32);
        point(190,36);
        point(210,40);
        point(230,44);
        point(250,48);
        point(270,52);
        point(290,56);
        point(310,57);
        point(330,56);
        point(350,52);
        point(370,48);
        point(390,44);
        point(410,40);
        point(430,36);
        point(450,32);
        point(470,28);
        point(490,24);
    }
    
    if(counter %3 == 0)
    {
        stroke(#FF0000);
        point(20,2);
        point(40,6);
        point(60,10);
        point(80,14);
        point(100,18);
        point(120,22);
        point(140,26);
        point(160,30);
        point(180,34);
        point(200,38);
        point(220,42);
        point(240,46);
        point(260,48);
        point(280,52);
        point(300,56);
        point(320,57);
        point(340,56);
        point(360,52);
        point(380,48);
        point(400,44);
        point(420,40);
        point(440,36);
        point(460,32);
        point(480,28);
        point(500,24);
    }
    
    //snow hills
    stroke(0);
    fill(#F7FFFF);
    strokeWeight(1);
    ellipse(150,500,500,400);
    ellipse(400,550,500,300);
    
    //Santa's Sleigh
    //presents
    fill(255,0,255);
    stroke(255,0,255);
    rect(355,280,100,100);
    stroke(0,255,0);
    fill(0,255,0);
    strokeWeight(1);
    rect(353,300,30,40);
    stroke(255,0,0);
    fill(255,0,0);
    rect(400,290,50,40);
    stroke(0,0,255);
    fill(0,0,255);
    rect(380,310,20,30);
    //sleigh
    strokeWeight(15);
    stroke(#009900);
    line(380,395,380,410);
    line(440,395,440,410);
    line(360,412,460,412);
    noStroke();
    fill(#D90026);
    rect(350,320,120,75);
    stroke(#009900);
    
     //text bubble
    stroke(0);
    strokeWeight(2);
    fill(255);
    triangle(290,250,320,230,320,270);
    ellipse(390,250,150,100);
    textSize(15);
    fill(0);
    text("It's Christmas eve,",330,230);
    text("and I have to get my",320,245);
    text("sleigh up! But there is",319,260);
    text("a terrible storm",340,275);
    text("coming!",360,290);
    
    //title 
    fill(0);
    textSize(50);
    text("Santa's Sleigh Rescue",-3,125);
    
    //santa claus
    //body
    stroke(255,0,0);
    fill(255,0,0);
    ellipse(250,310,80,100);
    rect(212,330,75,30);
    //belt
    stroke(0);
    fill(0);
    rect(211,330,77,10);
    //belt buckle
    stroke(#FFFF66);
    fill(0);
    strokeWeight(4);
    rect(245,330,10,10);
    //buttons
    stroke(255);
    strokeWeight(7);
    point(250,300);
    point(250,310);
    //arms
    stroke(255,0,0);
    fill(255,0,0);
    //legs
    stroke(255,0,0);
    fill(255,0,0);
    rect(227,360,10,20);
    rect(264,360,10,20);
    //boots
    stroke(0);
    fill(0);
    rect(227,380,10,10);
    ellipse(227,390,15,5);
    rect(264,380,10,10);
    ellipse(264,390,15,5);
    //face
    //skin
    fill(#FFFF94);
    stroke(255);
    strokeWeight(5);
    ellipse(250,250,70,70);
    //eyes
    stroke(0);
    strokeWeight(7);
    point(235,250);
    point(265,250);
    //pupils
    stroke(255);
    strokeWeight(2);
    point(234,249);
    point(264,249);
    //cheeks
   // stroke(#FFD6C2);
   // fill(#FFD6C2);
   stroke(#FF9C78);
   fill(#FF9C78);
    ellipse(235,260,10,5);
    ellipse(265,260,10,5);
    //hat
    //triangle
    strokeWeight(2);
    stroke(255,0,0);
    fill(255,0,0);
    triangle(215,235,250,160,285,235);
    //pom pom
    stroke(255);
    strokeWeight(25);
    point(250,160);
    //fur thing
    fill(255);
    strokeWeight(1);
    rect(214,215,71,20);
    ///beard
    strokeWeight(20);
    fill(256);
    point(220,265);
    point(225,275);
    point(235,275);
    point(245,275);
    point(255,275);
    point(265,275);
    point(275,275);
    point(280,265);
    point(235,285);
    point(245,285);
    point(255,285);
    point(265,285);
    
    //north pole sign
    //gold ball
    strokeWeight(25);
    stroke(#FFFF66);
    point(100,180);
    // white stripes
    strokeWeight(20);
    stroke(255);
    fill(255);
    rect(95,250,10,100);
    //red stripes
    strokeWeight(1);
    stroke(255,0,0);
    fill(255,0,0);
    rect(84,260,30,20);
    rect(84,300,30,20);
    rect(84,340,30,20);
    //sign
    strokeWeight(20);
     stroke(#D19E47);
    fill(#D19E47);
    rect(50,200,100,50);
    //text
    fill(0);
    textSize(20);
    text("North Pole",55,230);
    
    //play button
    stroke(0,255,0);
    fill(0,255,0);
     rect(200,430,100,50);
     fill(0);
     textSize(40);
     text("PLAY",200,470);
    if(mouseX<300 && mouseX>200 && mouseY>430 && mouseY<480 && counter > 10 && snowy < 10)
    {
    
      counter = 9;
    }
        if(mouseX<300 && mouseX>200 && mouseY>430 && mouseY<480 && counter < 10)
    {
    
      value = 1;
    }
    if(value == 1)
    {  
       strokeWeight(10);
        stroke(#CCFFFF);
        fill(#CCFFFF);
        rect(0,75,500,100);
        stroke(255);
       fill(255);
       ellipse(snowx,snowy,snowx+250,snowy + 200);
        snowy = snowy + 50;
        if(snowy>350)
        {
            snowy=350;
             stroke(0);
            strokeWeight(2);
            fill(255);
            triangle(290,250,320,230,320,270);
            ellipse(390,250,150,100);
            textSize(15);
            fill(0);
            text("Oh no! The snow! It's",319,260);
            text("everywhere!",340,275);  
        }
    if(counter > 30)
    {
        //snow reappears(text disappears)
        stroke(255);
        fill(255);
        ellipse(snowx,snowy,snowx+300,snowy+200);
        //face
        //skin
        fill(#FFFF94);
        stroke(255);
        strokeWeight(5);
        ellipse(250,50,70,70);
        //eyes
        stroke(0);
        strokeWeight(7);
        point(235,50);
        point(265,50);
        //pupils
        stroke(255);
        strokeWeight(2);
        point(234,49);
        point(264,49);
        //cheeks
       stroke(#FF9C78);
       fill(#FF9C78);
        ellipse(235,60,10,5);
        ellipse(265,60,10,5);
        //hat
        //triangle
        strokeWeight(2);
        stroke(255,0,0);
        fill(255,0,0);
        triangle(215,35,250,-60,285,35);
        //pom pom
        stroke(255);
        strokeWeight(25);
        point(250,-60);
        //fur thing
        fill(255);
        strokeWeight(1);
        rect(214,15,71,20);
        ///beard
        strokeWeight(20);
        fill(256);
        point(220,65);
        point(225,75);
        point(235,75);
        point(245,75);
        point(255,75);
        point(265,75);
        point(275,75);
        point(280,65);
        point(235,85);
        point(245,85);
        point(255,85);
        point(265,85);
    }
    if(counter > 55)
    {
        
        //snow hill
        background(#A3D2D5);
        //christmas village
        stroke(#B58217);
        fill(#B58217);
        rect(255,450,50,50);
        stroke(#996633);
        fill(#996633);
        triangle(240,450,275,425,310,450);
        stroke(#BF0040);
        fill(#BF0040);
        rect(350,450,50,50);
        stroke(#990000);
        fill(#990000);
        rect(445,450,50,50);
        stroke(#005726);
        fill(#005726);
        triangle(335,450,370,425,405,450);
        stroke(#000066);
        fill(#000066);
        triangle(430,450,465,425,500,450);
        //lights
        stroke(0);
        strokeWeight(2);
        line(235,455,500,455);
        stroke(#FFFFA6);
        strokeWeight(4);
        point(245,455);
        point(265,455);
        point(285,455);
        point(305,455);
        point(325,455);
        point(345,455);
        point(365,455);
        point(385,455);
        point(405,455);
        point(425,455);
        point(445,455);
        point(465,455);
        point(485,455);
        stroke(#9ECFFF);
        point(255,455);
        point(275,455);
        point(295,455);
        point(315,455);
        point(335,455);
        point(355,455);
        point(375,455);
        point(395,455);
        point(415,455);
        point(435,455);
        point(455,455);
        point(475,455);
        point(495,455);
        
        stroke(0);
        strokeWeight(1);
        fill(255);
        ellipse(-50,500,600,400);
        
        //christmas tree
        //trunk
        stroke(#663300);
        fill(#663300);
        rect(40,275,30,50);
        //leaves
        stroke(#006600);
        strokeWeight(1);
        fill(#006600);
        triangle(-30,290,60,40,140,290);
        //baubles       
        //pink ornaments
        strokeWeight(10);
        stroke(255,0,255);
        point(65,75);
        point(45,145);
        point(100,185);
        point(5,220);
        point(55,250);
        //red ornaments
        stroke(255,0,0);
        point(65,110);
        point(45,180);
        point(25,240);
        point(120,260);
        //green ornaments
        stroke(0,255,0);
        point(33,200);
        point(85,270);
        point(70,150);
        //blue ornaments
        stroke(0,255,255);
        point(90,250);
        point(10,270);
        point(20,170);
        point(50,90);
        //yellow ornaments
        stroke(#FFFF00);
        point(80,200);
        point(40,275);
        //star 
        stroke(#FFFF00);
        strokeWeight(30);
        point(60,35);
        
          //text bubble
        stroke(0);
        strokeWeight(2);
        fill(255);
        triangle(190,250,220,230,220,270);
        ellipse(290,250,150,100);
        textSize(13);
        fill(0);
        text("I can't find my sleigh!",230,230);
        text(" And I have to get the ",220,245);
        text("presents delivered! Will",219,260);
        text("you help me find all",230,275);
        text(" the pieces?",260,290);
        
        //santa claus
        //body
        strokeWeight(1);
        stroke(255,0,0);
        fill(255,0,0);
        ellipse(santax,310,80,100);
        rect(santax-38,333,75,30);
        //belt
        stroke(0);
        fill(0);
        rect(santax-39,330,77,10);
        //belt buckle
        stroke(#FFFF66);
        fill(0);
        strokeWeight(4);
        rect(santax-5,330,10,10);
        //buttons
        stroke(255);
        strokeWeight(7);
        point(santax,300);
        point(santax,310);
        //arms
        stroke(155,0,0);
        fill(155,0,0);
        //legs
        stroke(255,0,0);
        fill(255,0,0);
        rect(santax-23,360,10,20);
        rect(santax+14,360,10,20);
        //boots 
        stroke(0);
        fill(0);
        rect(santax-23,380,10,10);
        ellipse(santax-23,390,15,5);
        rect(santax+14,380,10,10);
        ellipse(santax+14,390,15,5);
        //face
        //skin
        fill(#FFFF94);
        stroke(255);
        strokeWeight(5);
        ellipse(santax,250,70,70);
        //eyes  
        stroke(0);
        strokeWeight(7);
        point(santax - 15,250);
        point(santax + 15,250);
        //pupils
        stroke(255);
        strokeWeight(2);
        point(santax - 16,249);
        point(santax + 14,249);
        //cheeks
       stroke(#FF9C78);
       fill(#FF9C78);
       ellipse(santax - 15,260,10,5);    
       ellipse(santax + 15,260,10,5);
       //hat
       //triangle
       strokeWeight(2);
       stroke(255,0,0);
       fill(255,0,0);
       triangle(santax - 35,235,santax,160,santax + 35,235);
       //pom pom
       stroke(255);
       strokeWeight(25);
       point(santax,160);
       //fur thing
       fill(255);
       strokeWeight(1);
       rect(santax-36,215,71,20);
       //beard
       strokeWeight(20);
       fill(256);
       point(santax-30,265);
       point(santax-25,275);
       point(santax-15,275);
       point(santax - 5,275);
       point(santax + 5,275);
       point(santax + 15,275);
       point(santax + 25,275);
       point(santax + 30,265);
       point(santax - 15,285);
       point(santax - 5,285);
       point(santax + 5,285);
       point(santax + 15,285);
        
        //directions
        textSize(20);
        fill(255,0,0);
        text("Use the arrow keys to",10,440);
        text("move Santa around to",10,460);
        text("find parts for his sleigh!",10,480);
        
        //blocks on walls
            
        if(santax > 450)
        {
            santax = 450;
        }
        if(santay > 300)
        {
            santay = 300;
        }
        if(santay < 20)
        {
            santay = 20;
        }
        if(santax < -25)
        {
            value2 = 1;
            //new santa position
            santax = 400;
        }
        if(value2 == 1)
        {
            background(#A3D2D5); 
            //hill
            stroke(255);
            fill(255);
            ellipse(250,500,700,400);
            
        //santa claus
        //body
        strokeWeight(1);
        stroke(255,0,0);
        fill(255,0,0);
        ellipse(santax,310,80,100);
        rect(santax-38,333,75,30);
        //belt
        stroke(0);
        fill(0);
        rect(santax-39,330,77,10);
        //belt buckle
        stroke(#FFFF66);
        fill(0);
        strokeWeight(4);
        rect(santax-5,330,10,10);
        //buttons
        stroke(255);
        strokeWeight(7);
        point(santax,300);
        point(santax,310);
        //arms
        stroke(155,0,0);
        fill(155,0,0);
        //legs
        stroke(255,0,0);
        fill(255,0,0);
        rect(santax-23,360,10,20);
        rect(santax+14,360,10,20);
        //boots 
        stroke(0);
        fill(0);
        rect(santax-23,380,10,10);
        ellipse(santax-23,390,15,5);
        rect(santax+14,380,10,10);
        ellipse(santax+14,390,15,5);
        //face
        //skin
        fill(#FFFF94);
        stroke(255);
        strokeWeight(5);
        ellipse(santax,250,70,70);
        //eyes  
        stroke(0);
        strokeWeight(7);
        point(santax - 15,250);
        point(santax + 15,250);
        //pupils
        stroke(255);
        strokeWeight(2);
        point(santax - 16,249);
        point(santax + 14,249);
        //cheeks
       stroke(#FF9C78);
       fill(#FF9C78);
       ellipse(santax - 15,260,10,5);    
       ellipse(santax + 15,260,10,5);
       //hat
       //triangle
       strokeWeight(2);
       stroke(255,0,0);
       fill(255,0,0);
       triangle(santax - 35,235,santax,160,santax + 35,235);
       //pom pom
       stroke(255);
       strokeWeight(25);
       point(santax,160);
       //fur thing
       fill(255);
       strokeWeight(1);
       rect(santax-36,215,71,20);
       //beard
       strokeWeight(20);
       fill(256);
       point(santax-30,265);
       point(santax-25,275);
       point(santax-15,275);
       point(santax - 5,275);
       point(santax + 5,275);
       point(santax + 15,275);
       point(santax + 25,275);
       point(santax + 30,265);
       point(santax - 15,285);
       point(santax - 5,285);
       point(santax + 5,285);
       point(santax + 15,285);
       //first piece for sleigh
       strokeWeight(15);
       stroke(#009900);
       line(200,piece,210,piece+25);
       stroke(255);
       fill(255);
       ellipse(210,415,5,20);
       //directions for pickup
       fill(255,0,0);
       text("To pick up pieces for the sleigh,",10,470);
       text(" walk over them.",40,490);
       if(santax > 200 && santax < 220)
       {
           piece = 90;
           fill(0,0,255);
           text("You got a piece!",150,50);
        }
        }
 }
        
    counter++;
    }
}
void keyPressed() 
{
  if (key == CODED) 
  {
    if (keyCode == UP) 
    {
      santay = santay - 5;
    } 
    else if (keyCode == DOWN) 
    {
      santay = santay + 5;
    } 
    else if (keyCode == RIGHT)
    {
        santax = santax + 5;
    }
    else if (keyCode == LEFT)
    {
        santax = santax - 5;
    }
  } 
}