> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://designuniandes.sketchpad.cc/sp/pad/view/ro.S502KhlhpSX/rev.10
 * 
 * authors: 
 *   Samuel Sanchez

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



// This sketch builds on a prior work, "Assignment 3: Movement", created by Hernando Barragan
// http://designuniandes.sketchpad.cc/sp/pad/view/ro.B7dgIfNu$GCReL/rev.1

fantasma cosa1;
globo cosa2;
globo2 cosa3;
pupila1 cosa4;
void setup()
{
size(400, 200);
background (0); 
cosa1 = new fantasma(); 
cosa2 = new globo(); 
cosa3 = new globo2(); 
cosa4 = new pupila1(); 
}
void draw (){
background (0); 
cosa1.dibujarse(); 
cosa1.moverse(); 
cosa2.dibujarglobo (); 
cosa2.moverglobo(); 
cosa3.dibujarglobo2(); 
cosa3.moverglobo2(); 
cosa4.dibujarpupila1();
cosa4.moverpupila1();
fill(4,2,203);
rect(10, 126,195, 2);//partearribabarra1
rect(10, 152, 195,2);//parteabajobarra1
rect(205,128,2,2);
rect(205,150,2,2);
rect(8,128, 2,2);
rect(8,150, 2,2);
rect(6,130,2,20);
rect(207,130,2,20);
rect(156,0,2,24);//barrasuperiorparte1
rect(160,26,270,2);//barrasuperiorparte2
rect(158,24,2,2);

rect(307,128,2,230);
rect(309,126,2,2);
rect(311,124,200,2);

}
class fantasma {
float x;
float y; 
float w=5;

public fantasma() {
// x= random (width/2);
//y= random (height/2);
x= -100;
y= 1;
}
void dibujarse() {
noStroke();//body1
background (0); 
fill(137,247, 241);
beginShape();
vertex(x+40,y+30);
vertex(x+70,y+30);
vertex(x+70,y+35);
vertex(x+85,y+35);
vertex(x+85,y+39);
vertex(x+89,y+39);
vertex(x+89,y+44);
vertex(x+93,y+44);
vertex(x+93,y+65);
vertex(x+96,y+65);
vertex(x+96,y+125);
vertex(x+90,y+125);
vertex(x+90,y+120);
vertex(x+85,y+120);
vertex(x+85, y+115);
vertex(x+80, y+115);
vertex(x+80, y+120);
vertex(x+75, y+120);
vertex(x+75, y+125);
vertex(x+59, y+125);
vertex(x+59, y+115);
vertex(x+49,y+115);
vertex(x+49, y+125);
vertex(x+33,y+125); 
vertex(x+33, y+120);
vertex(x+28, y+120);
vertex(x+28, y+115);
vertex(x+23, y+115);
vertex(x+23, y+120); 
vertex(x+18,y+120);
vertex(x+18,y+125);
vertex(x+12,y+125); 
vertex(x+12,y+65);
vertex(x+17, y+65);
vertex(x+17, y+44);
vertex(x+21,y+44);
vertex(x+21,y+ 39);
vertex(x+25, y+39);
vertex(x+25,y+35);
vertex(x+40,y+35);
vertex(x+40,y+30);
endShape();
}
void moverse() { 
x= x+w;
if (x>420) {
x = -40;
}
}
}
class globo {
float x;
float y; 
float w=5;

public globo(){
x= -100; 
y= 1; 
}

void dibujarglobo(){
fill(255);
beginShape(); 
vertex (x+89, y+44);
vertex (x+89,y+ 44);
vertex (x+89,y+ 49);
vertex (x+93,y+ 49);
vertex (x+93,y+ 70);
vertex (x+89,y+70);
vertex (x+89,y+75);
vertex (x+77, y+75);
vertex (x+77, y+70);
vertex (x+72, y+70);
vertex (x+72, y+49);
vertex (x+77, y+49);
vertex (x+77,y+44);
endShape();
}
void moverglobo() { 
x= x+w;
if (x>420) {
x = -40;
}
}
}
class globo2 {
float x;
float y; 
float w=5;

public globo2(){
x= -100; 
y= 1; 
}
void dibujarglobo2(){
fill(255);
beginShape();
vertex(x+96,y+44);
vertex(x+90,y+44);
vertex(x+90,y+49);
vertex(x+55,y+49);
vertex(x+55,y+70);
vertex(x+51,y+70);
vertex(x+51,y+75);
vertex(x+39,y+75);
vertex(x+39,y+70);
vertex(x+34,y+70);
vertex(x+34,y+49);
vertex(x+39,y+49);
vertex(x+39,y+44);
endShape();
}
void moverglobo2() { 
x= x+w;
if (x>420) {
x = -40;

}
}
}
class pupila1 {
float x;
float y; 
float w=5;

public pupila1(){
x= -100; 
y= 1; 
}

void dibujarpupila1(){
fill(33);
rect (46+x, 54+y, 9, 16);//ojoizquierdo
rect(84+x,54+y, 9, 16); 
}
void moverpupila1() { 
x= x+w;
if (x>420) {
x = -40;

}
}
}