xxxxxxxxxx
34
/*
----- Coding Tutorial by Patt Vira -----
Name: Exploding Hearts
Video Tutorial: https://youtu.be/YgDY7l2W9eE
Connect with Patt: @pattvira
https://www.pattvira.com/
----------------------------------------
*/
let hearts = [];
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
}
function draw() {
background("#fffbe6");
for (let i=hearts.length-1; i>=0; i--) {
hearts[i].updateHeart();
hearts[i].displayHeart();
if (hearts[i].done == true) {
hearts.splice(i, 1);
}
}
}
function mousePressed() {
hearts.push(new Heart(mouseX, mouseY));
}