()
| 37 | } |
| 38 | |
| 39 | function createInsect() { |
| 40 | const insect = document.createElement('div') |
| 41 | insect.classList.add('insect') |
| 42 | const { x, y } = getRandomLocation() |
| 43 | insect.style.top = `${y}px` |
| 44 | insect.style.left = `${x}px` |
| 45 | insect.innerHTML = `<img src="${selected_insect.src}" alt="${selected_insect.alt}" style="transform: rotate(${Math.random() * 360}deg)" />` |
| 46 | |
| 47 | insect.addEventListener('click', catchInsect) |
| 48 | |
| 49 | game_container.appendChild(insect) |
| 50 | } |
| 51 | |
| 52 | function getRandomLocation() { |
| 53 | const width = window.innerWidth |
nothing calls this directly
no test coverage detected