Your browser does not support the canvas tag.

previous        Show / Hide Source    Download        next
void setup() {
  size (400, 400);
  frameRate(30);
}

void draw() {
  //Draw BG
  stroke(255, 255, 255);
  fill(80, 0, 70);
  background(100, 15, 90);
  line(0, 0, 120, 100);
  line(400, 0, 280, 100);
  line(120, 240, 0, 340);
  line(280, 240, 400, 340);
  rectMode(CORNER);
  rect(120, 100, 160, 140);

  //Pentagram
  noFill();
  stroke(150, 0, 0);
  ellipse(200, 170, 120, 120);
  line(200, 111, 249, 206);
  line(249, 206, 142, 157);
  line(142, 157, 257, 157);
  line(257, 157, 151, 206);
  line(151, 206, 200, 111);

  //Draw enemy
  stroke(0, 0, 0);
  fill (200, 0, 0);
  triangle(200, 100, 220, 200, 180, 200); //Spikes
  triangle(200, 300, 220, 200, 180, 200);
  triangle(100, 200, 200, 220, 200, 180);
  triangle(300, 200, 200, 220, 200, 180);
  ellipse(200, 200, 100, 100); //Main body
  fill(255, 255, 255); //Eye
  ellipse(200, 200, 50, 50);
  fill(0, 0, 0); //Pupil
  ellipse(200, 200, 20, 20);
  stroke(200, 0, 0); //"Eyelid"
  fill (200, 0, 0);
  ellipse (200, 185, 40, 20);

  //Crosshair
  stroke(0, 255, 0);
  noFill();
  ellipse(mouseX, mouseY, 90, 90);
  rectMode(CENTER);
  rect(mouseX, mouseY, 150, 0);
  rect(mouseX, mouseY, 0, 150);

  //Shotgun
  stroke(0, 0, 0);
  fill(50, 50, 50);
  rect(mouseX, 375, 75, 100);
}

//Blink
void keyPressed() {
  stroke(200, 0, 0);
  fill (200, 0, 0);
  ellipse(200, 200, 90, 90);
}

//Shotgun fire effect
void mousePressed() {
  rectMode(CORNERS);
  fill(100, 100, 0, 175);
  rect(0, 0, 400, 400);
  fill(255, 255, 30);
  stroke(255, 255, 255);
  ellipse(mouseX, 300, 150, 150);
}