summaryrefslogtreecommitdiff
path: root/Year_2/IandM/02142018/02142018.pde
blob: 6bc87abbc299cab30a27822022426d4a368c8844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ArrayList<Heart> hearts = new ArrayList<Heart>();
void setup() {
  size(512, 512);
  background(#011146);
  frameRate(60);
}
void draw() {
  fill(#011146, 100);
  rect(0, 0, width, height);

  if ((int)random(1, 101) <= 5) {
    Heart tmp = new Heart((int)random(0, width), height/2+10);
    hearts.add(tmp);
  }

  for (Heart h : hearts) {
    h.draw();
  }
}

void mouseClicked() {
  for (Heart h : hearts) {  
    if (dist(h.positionx(), h.positiony(), mouseX, mouseY) < 30) {
      h.die();
    }
  }
}