Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//   Light Cycle       //
// by Michael Pereira  //


void setup() {
  size(400,400);
}

void draw() {
  // Draw background =========================================================================
  background(30,40,80);
  
  // Draw buldings black
  fill(0);
  rect(90,70,50,150);
  rect(100,20,20,50);
  rect(60,150,40,70);
  rect(180,150,40,70);
  rect(220,190,20,30);
  rect(290,80,40,140);
  rect(330,180,20,40);
  
  // Draw buildings grey
  fill(60);
  rect(0,120,60,100);
  rect(120,120,60,100);
  rect(240,140,80,100);
  rect(350,150,50,70);
  
  // Draw road
  fill(140,140,180);
  rect(0,220,400,400);
  
  // Draw road lights
  fill(0,255,200);
  rect(300,280,60,20);
  rect(190,280,60,20);
  rect(80,280,60,20);
  rect(0,280,30,20);
  
  // Draw Light Bike shapes ==================================================================
  
  // Draw light bike body
  noStroke();
  fill(255,255,255);           //white bottom of bike
  rect(mouseX-40,270,90,30);

  fill(0,mouseY,225);          // colour for bike. moving mouse up and down changes colour.
  ellipse(mouseX,270,100,50);  // This ellipse lines up with the mouse.

  // Draw light bike tires
  ellipse(mouseX-40,290,40,40);// Tires and window need to be offset from the mouse.
  ellipse(mouseX+40,295,30,30);
  
  fill(0,0,0);
  ellipse(mouseX-40,290,30,30);
  ellipse(mouseX+40,295,20,20);

  // Draw window
  ellipse(mouseX-20,265,50,20);
  fill(0,mouseY,225);
  rect(mouseX-10,250,30,30);
}