xxxxxxxxxx
153
// var x = 800
// var y = 100
// // //for moving bus on its own
var x
var y
// for moving bus w mouse
function setup() {
createCanvas(800, 350);
}
function draw() {
background(188, 255, 168);
stroke(1);
strokeWeight(1);
fill(158, 192, 214);
rect(120, 160, 70, 40); // face
textSize(14);
fill(0);
textStyle(BOLD);
text("Move the mouse around to move the bus!",10, 10);
fill(8, 74, 130);
strokeWeight(1);
rect(110, 170, 10, 10); //head pieces
rect(190, 170, 10, 10);
triangle(130, 140, 140, 160, 150, 140);
triangle(160, 140, 170, 160, 180, 140);
fill(255);
strokeWeight(2);
ellipse(140, 180, 20, 20); //eyes
ellipse(170, 180, 20, 20);
fill(random(0,255), random(0,255), random(0,255));
ellipse(140, 180, 10, 10); //eyeballs
ellipse(170, 180, 10, 10);
fill(158, 192, 214);
strokeWeight(1);
triangle(155, 200, 125, 260, 185, 260); //body
line(155, 200, 155, 260);
fill(255, 0, 0);
noStroke();
ellipse(155, 220, 5, 5); //buttons
ellipse(155, 230, 5, 5);
ellipse(155, 240, 5, 5);
ellipse(155, 250, 5, 5);
fill(158, 192, 214);
stroke(1)
rect(135, 260, 10, 40); //legs
rect(165, 260, 10, 40);
rect(105, 210, 40, 10); //arms
rect(165, 210, 40, 10);
fill(239, 182, 131);
noStroke()
ellipse(100, random(210, 220), 10, 10); //hands
ellipse(210, random(210, 220), 10, 10);
ellipse(random(135, 145), 305, 10, 10); //feet
ellipse(random(165, 175), 305, 10, 10);
fill(109, 60, 4);
strokeWeight(1);
rect(0, 310, 800, 100); //ground
fill(0);
strokeWeight(1);
bezier(140, 195, 150, 205, 160, 185, 170, 195); //mouth
fill(255);
noStroke();
ellipse(150, 110, 50, 50);
ellipse(190, 100, 60, 60);
ellipse(230, 80, 70, 70);
textSize(14);
fill(0);
textStyle(BOLD);
text("Come on, bus!", 150, 105);
x = mouseX
y = 100
// for moving bus w mouse
//bus
stroke(1);
strokeWeight(2);
fill(255);
rect(x, y, 300, 170); //bus outline
fill(0, 2, 178);
rect(x, y + 120, 300, 20); //blue line
fill(0);
ellipse(x + 50, y + 175, 70, 70);
ellipse(x + 250, y + 175, 70, 70);
fill(150);
ellipse(x + 50, y + 175, 45, 45);
ellipse(x + 250, y + 175, 45, 45);
//wheels
// fill(255);
// quad(420, 90, 550, 90, 560, 100, 410, 100);
fill(255);
rect(x, y+10, 280, 80);
fill(0);
line(x+50, y+10, x+50, 190);
line(x+130, y+10, x+130, 190);
line(x+200, y+10, x+200, 190); //windows
fill(150);
rect(x+300, y+140, 40, 20);
textSize(15);
fill(0, 102, 153);
text("MTA New York City Bus", x+10, y+110);
fill(random(0, 255));
noStroke();
ellipse(x+360, y+150, 30, 20);
ellipse(x+380, y+150, 30, 20);
ellipse(x+400, y+150, 30, 20); //smoke
// if (x > 90) {
// x = x-2
// }
// //for moving bus on its own
// //the conditional statement makes the bus stop
// // the value in the x equation is the speed of the bus
}