mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 04:07:23 +00:00
Add delay before hopping repeatedly
This commit is contained in:
@@ -90,9 +90,10 @@ const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
||||
const PET_MENU_COOLDOWN = 1000;
|
||||
const URL_CHECK_INTERVAL = 500;
|
||||
const HOP_DELAY = 500;
|
||||
|
||||
// Random event chances per tick
|
||||
const HOP_CHANCE = 1 / (60 * 3); // Every 3 seconds
|
||||
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
||||
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
||||
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
||||
|
||||
@@ -479,7 +480,7 @@ Promise.all([
|
||||
|
||||
function update() {
|
||||
ticks++;
|
||||
|
||||
|
||||
// Hide bird if the browser is fullscreen
|
||||
if (document.fullscreenElement) {
|
||||
birb.setVisible(false);
|
||||
@@ -487,7 +488,7 @@ Promise.all([
|
||||
}
|
||||
|
||||
if (currentState === States.IDLE && !frozen && !isMenuOpen()) {
|
||||
if (Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||
if (Date.now() - stateStart > HOP_DELAY && Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||
hop();
|
||||
} else if (Date.now() - lastActionTimestamp > AFK_TIME) {
|
||||
// Idle for a while, do something
|
||||
|
||||
Reference in New Issue
Block a user