|
|
@ -1,3 +1,13 @@ |
|
|
|
function setNumBees() { |
|
|
|
const numBeeDiv = document.getElementById("numBeeText"); |
|
|
|
const numBees = document.getElementsByClassName("bee").length; |
|
|
|
numBeeDiv.innerHTML = `${numBees} bee${numBees == 1 ? '' : 's'}. `; |
|
|
|
if(numBees >= 10) |
|
|
|
{ |
|
|
|
numBeeDiv.innerHTML += " That's a lot of bees!"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function addBee() { |
|
|
|
const rect = document.body.getBoundingClientRect(); |
|
|
|
const width = rect.width; |
|
|
@ -16,9 +26,13 @@ function addBee() { |
|
|
|
bee.style.left = `${bee.vars.x}px`; |
|
|
|
|
|
|
|
document.body.appendChild(bee); |
|
|
|
|
|
|
|
setNumBees(); |
|
|
|
} |
|
|
|
|
|
|
|
window.onload = function() { |
|
|
|
setNumBees(); |
|
|
|
|
|
|
|
const rect = document.body.getBoundingClientRect(); |
|
|
|
const width = rect.width; |
|
|
|
const height = rect.height; |
|
|
|