diff --git a/birb.js b/birb.js index 0e35ebd..d777f11 100644 --- a/birb.js +++ b/birb.js @@ -603,7 +603,7 @@ function insertStartMenu() { } let x = birdX; let y = window.innerHeight - birdY; - const offset = 30; + const offset = 20; if (x < window.innerWidth / 2) { // Left side x += offset; @@ -613,7 +613,7 @@ function insertStartMenu() { } if (y > window.innerHeight / 2) { // Top side - y -= startMenu.offsetHeight + offset; + y -= startMenu.offsetHeight + offset + 10; } else { // Bottom side y += offset; @@ -629,6 +629,10 @@ function removeStartMenu() { } } +function isStartMenuOpen() { + return document.querySelector(".birb-window") !== null; +} + function makeDraggable(windowHeader) { let isMouseDown = false; let offsetX = 0; @@ -695,7 +699,7 @@ let petStack = []; function update() { ticks++; if (currentState === States.IDLE) { - if (Math.random() < 1 / (60 * 3)) { + if (Math.random() < 1 / (60 * 3) && !isStartMenuOpen()) { hop(); } } else if (currentState === States.HOP) { @@ -767,7 +771,7 @@ function draw() { } if (focusedElement === null) { - if (Date.now() - timeOfLastAction > AFK_TIME) { + if (Date.now() - timeOfLastAction > AFK_TIME && !isStartMenuOpen()) { // Fly to an element if the user is AFK focusOnElement(); timeOfLastAction = Date.now();