> show canvas only <


/* built with Studio Sketchpad: 
 *   http://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   http://studio.sketchpad.cc/sp/pad/view/ro.p4dFnbqEyOG/rev.2
 * 
 * authors: 
 *   GoToLoop

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



/**
 Alien Invader
 by cochraneowns (2013/Apr)
 
 http://forum.processing.org/topic/what-websites-work-best-when-using-processing-js
 
 */

void setup() {
  size(0300, 0300);
  colorMode(HSB, 360, 0200, 1);
  smooth();
  noLoop();
  noStroke();
  cursor(CROSS);
  rectMode(CENTER);
}

void mousePressed() {
  redraw();
  fill(random(360), random(0100, 0200), 1);
}

void mouseReleased() {
  redraw();
}

void draw() {
  background(0);

  if (!mousePressed)  return;

  translate(width >> 2, height >> 2);

  //body:
  rect(50, 30, 50, 10);
  rect(20, 40, 10, 10);
  rect(80, 40, 10, 10);
  rect(10, 55, 10, 20);
  rect(90, 55, 10, 20);
  rect(20, 70, 10, 10);
  rect(80, 70, 10, 10);
  rect(50, 80, 50, 10);
  rect(20, 90, 10, 10);
  rect(80, 90, 10, 10);

  //crown:
  rect(50, 23, 30, 5);
  rect(33, 18, 5, 5);
  rect(67, 18, 5, 5);
  rect(29, 13, 5, 5);
  rect(71, 13, 5, 5);
  rect(50, 18, 11, 5);
  rect(50, 13, 5, 5);

  //face:
  rect(35, 50, 5, 5);
  rect(65, 50, 5, 5);
  rect(50, 65, 20, 5);
}