diff options
Diffstat (limited to 'Year_2/IandM/02142018/02142018.pde')
-rw-r--r-- | Year_2/IandM/02142018/02142018.pde | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Year_2/IandM/02142018/02142018.pde b/Year_2/IandM/02142018/02142018.pde new file mode 100644 index 0000000..6bc87ab --- /dev/null +++ b/Year_2/IandM/02142018/02142018.pde @@ -0,0 +1,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(); + } + } +} |