Move to random position
function moveToRandomPosition(item) {
const x = random(item.width / 2, 768 - item.width / 2);
const y = random(item.height / 2, 1024 - item.height / 2);
item.move(x, y);
}
Play a sound when we win
function isPopped(balloon) {
return balloon.hidden;
}
function didWePopEveryBalloon() {
return balloons.every(isPopped);
}
function weWon() {
sound("hooray");
}
function seeIfWeWon() {
if (didWePopEveryBalloon()) {
weWon();
}
}
fill("lightblue");
stamp("balloon", 120);
stamp("icon reflection");