Code edit (1 edits merged)
Please save this source code
User prompt
Boredom Clicker
Initial prompt
Design a simple mobile-friendly clicker game called **“Boredom Clicker”**. Concept: - The player controls a bored office worker trying to stay motivated. - The goal is to keep the “Motivation Bar” full by tapping repeatedly. - If the bar reaches zero, the game ends with a “Burnout” message. Core Mechanics: - Tap the screen to increase the motivation bar. - Bonus buttons appear occasionally: - ☕ Coffee: quick +10 motivation - 🎧 Music: triggers auto-increase for 10 seconds - 🌇 Look outside: gives a small bonus and changes background - The bar decreases over time — faster at higher levels. Risk System (optional): - Using too many bonuses may trigger the “Boss Alert” popup. - After 3 alerts, the game ends (“You got fired!”). Upgrade Ideas (optional): - Auto-clicker: generates motivation every second - “Copy-Paste Assistant”: slows bar decay - “Zen Plant”: occasional bonus boosts Visuals: - Minimal UI: character desk, motivation bar, popup buttons - Background shifts with score (gray → sunny → floral, etc.) - Light-hearted and humorous tone Requirements: - Mobile-optimized - Single-touch input (tap/tap-hold) - Keep the code and visuals minimal and clean
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var BonusButton = Container.expand(function (type) {
var self = Container.call(this);
self.type = type;
self.isActive = false;
self.lifetime = 5000; // 5 seconds
self.timer = 0;
// Add glow background with type-specific color
var glowAssetName = 'glowEffect';
if (type === 'coffee') {
glowAssetName = 'glowEffectCoffee';
} else if (type === 'music') {
glowAssetName = 'glowEffectMusic';
} else if (type === 'outside') {
glowAssetName = 'glowEffectOutside';
}
var glowBg = self.attachAsset(glowAssetName, {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0
});
glowBg.zIndex = -1;
var buttonAsset;
if (type === 'coffee') {
buttonAsset = self.attachAsset('coffeeButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (type === 'music') {
buttonAsset = self.attachAsset('musicButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (type === 'outside') {
buttonAsset = self.attachAsset('outsideButton', {
anchorX: 0.5,
anchorY: 0.5
});
}
self.activate = function () {
self.isActive = true;
self.timer = 0;
// Start glow effect with more transparent alpha
glowBg.alpha = 0.15;
self.startGlowPulse();
// Popup motion - start small and bounce to larger size
tween(self, {
scaleX: 1.4,
scaleY: 1.4
}, {
duration: 400,
easing: tween.bounceOut
});
// Add a slight bounce back down
tween.stop(self, {
scaleX: true,
scaleY: true
});
LK.setTimeout(function () {
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200,
easing: tween.easeOut
});
}, 400);
};
self.startGlowPulse = function () {
if (!self.isActive) return;
// Pulse the glow with more transparent alpha values
tween(glowBg, {
alpha: 0.35,
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.isActive) {
tween(glowBg, {
alpha: 0.15,
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startGlowPulse();
}
});
}
}
});
};
self.update = function () {
if (self.isActive) {
self.timer += 16; // ~60fps
if (self.timer >= self.lifetime) {
self.deactivate();
}
}
};
self.deactivate = function () {
self.isActive = false;
// Stop glow animation
tween.stop(glowBg);
tween(glowBg, {
alpha: 0
}, {
duration: 300
});
tween(self, {
scaleX: 0,
scaleY: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
};
self.down = function (x, y, obj) {
if (self.isActive) {
bonusUsed++;
playerScore += 10; // Add 10 points for capturing any power-up
if (self.type === 'coffee') {
motivation = Math.min(100, motivation + 15);
LK.getSound('coffee').play();
LK.getSound('coffeeSound').play();
} else if (self.type === 'music') {
motivation = Math.min(100, motivation + 25);
musicBonus = 600; // 10 seconds at 60fps
LK.getSound('buttonClick').play();
LK.getSound('musicSound').play();
} else if (self.type === 'outside') {
motivation = Math.min(100, motivation + 20);
backgroundMode = Math.min(2, backgroundMode + 1);
updateBackground();
LK.getSound('outsideSound').play();
LK.getSound('buttonClick').play();
}
if (bonusUsed >= 3) {
bossAlerts++;
bonusUsed = 0;
showBossAlert();
}
self.deactivate();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x666666
});
/****
* Game Code
****/
var motivation = 50; // 0-100
var motivationDecayRate = 0.1; // per frame
var bossAlerts = 0;
var bonusUsed = 0;
var musicBonus = 0; // frames remaining
var backgroundMode = 0; // 0=gray, 1=mixed, 2=sunny
var level = 0;
var gameRunning = true;
// Start background music
LK.playMusic('backgroundMusic');
var clickCount = 0; // Track clicks in current window
var clickTimer = 0; // Timer to reset click count
var clickThreshold = 30; // Max clicks allowed in time window
var clickWindow = 480; // 8 seconds at 60fps
var motivationWasFull = false; // Track if motivation reached 100
var clicksAfterFull = 0; // Count clicks after motivation reaches 100
var playerScore = 0; // Score from capturing power-ups
// UI Elements
var motivationBarBg = game.addChild(LK.getAsset('motivationBarBg', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 100
}));
var motivationBarFill = game.addChild(LK.getAsset('motivationBarFill', {
anchorX: 0,
anchorY: 0,
x: 725,
y: 101
}));
var background = game.addChild(LK.getAsset('backgroundGray', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
background.zIndex = -1;
// Move background to back manually since sortChildren is not available
game.removeChild(background);
game.addChildAt(background, 0);
// Score and level display
var scoreText = new Text2('Score: 0', {
size: 40,
fill: 0xFFFFFF,
font: "'Arial Black', Arial, sans-serif"
});
scoreText.anchor.set(0, 0);
scoreText.x = 120;
scoreText.y = 20;
game.addChild(scoreText);
// Motivation text above the motivation bar
var motivationText = new Text2('Motivation: 50%', {
size: 40,
fill: 0xFFFFFF,
font: "'Arial Black', Arial, sans-serif"
});
motivationText.anchor.set(0.5, 1);
motivationText.x = 1024;
motivationText.y = 95;
game.addChild(motivationText);
// Level text removed
var bossAlertText = new Text2('Boss Alerts: 0/3', {
size: 30,
fill: 0xFFFF00
});
bossAlertText.anchor.set(1, 0);
bossAlertText.x = 2028;
bossAlertText.y = 20;
game.addChild(bossAlertText);
// Bonus buttons
var bonusButtons = [];
var coffeeBtn = new BonusButton('coffee');
coffeeBtn.x = 300;
coffeeBtn.y = 300;
coffeeBtn.visible = false;
game.addChild(coffeeBtn);
bonusButtons.push(coffeeBtn);
var musicBtn = new BonusButton('music');
musicBtn.x = 1024;
musicBtn.y = 400;
musicBtn.visible = false;
game.addChild(musicBtn);
bonusButtons.push(musicBtn);
var outsideBtn = new BonusButton('outside');
outsideBtn.x = 1700;
outsideBtn.y = 300;
outsideBtn.visible = false;
game.addChild(outsideBtn);
bonusButtons.push(outsideBtn);
// Boss alert popup
var bossAlertPopup = null;
var bossAlertTimer = 0;
var bonusSpawnTimer = 0;
var bonusSpawnInterval = 120; // 2 seconds at 60fps
function updateMotivationBar() {
var fillWidth = motivation / 100 * 598;
motivationBarFill.width = Math.max(0, fillWidth);
// Color coding
if (motivation > 70) {
motivationBarFill.tint = 0x00ff00; // Green
} else if (motivation > 30) {
motivationBarFill.tint = 0xffff00; // Yellow
} else {
motivationBarFill.tint = 0xff0000; // Red
}
}
function updateBackground() {
if (backgroundMode === 0) {
background.tint = 0x666666; // Gray
} else if (backgroundMode === 1) {
background.tint = 0x87CEEB; // Sky blue
} else {
background.tint = 0x90EE90; // Light green
}
}
function showBossAlert() {
if (bossAlertPopup) {
bossAlertPopup.destroy();
}
bossAlertPopup = game.addChild(LK.getAsset('bossAlert', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
var alertText = new Text2('BOSS ALERT!', {
size: 50,
fill: 0xFFFFFF
});
alertText.anchor.set(0.5, 0.5);
bossAlertPopup.addChild(alertText);
LK.getSound('alert').play();
LK.effects.flashScreen(0xff0000, 500);
bossAlertTimer = 180; // 3 seconds
if (bossAlerts >= 3) {
LK.setTimeout(function () {
LK.showGameOver('Fired!', 'Need a job?');
}, 2000);
gameRunning = false;
}
}
function spawnBonusButton() {
var availableButtons = bonusButtons.filter(function (btn) {
return !btn.isActive;
});
if (availableButtons.length > 0) {
var randomBtn = availableButtons[Math.floor(Math.random() * availableButtons.length)];
// Position randomly on screen with some margin from edges
var margin = 100;
randomBtn.x = margin + Math.random() * (2048 - 2 * margin);
randomBtn.y = margin + Math.random() * (2732 - 2 * margin);
randomBtn.visible = true;
randomBtn.scaleX = 0;
randomBtn.scaleY = 0;
randomBtn.activate();
}
}
// Main tap area
game.down = function (x, y, obj) {
if (gameRunning) {
motivation = Math.min(100, motivation + 5);
LK.getSound('buttonClick').play();
LK.getSound('motivationUp').play();
// Check if motivation reached full
if (motivation >= 100 && !motivationWasFull) {
motivationWasFull = true;
clicksAfterFull = 0; // Reset counter when reaching full
}
// Track clicks for boss alert system - only after motivation was full
if (motivationWasFull) {
clicksAfterFull++;
if (clicksAfterFull >= 5) {
bossAlerts++;
clicksAfterFull = 0; // Reset after triggering alert
showBossAlert();
}
} else {
// Original click tracking system for backwards compatibility
clickCount++;
if (clickCount >= clickThreshold) {
bossAlerts++;
clickCount = 0; // Reset after triggering alert
clickTimer = 0; // Reset timer
showBossAlert();
}
}
// Visual feedback
tween(game, {
scaleX: 1.02,
scaleY: 1.02
}, {
duration: 100,
onFinish: function onFinish() {
tween(game, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
}
};
game.update = function () {
if (!gameRunning) return;
// Decay motivation
var decayAmount = motivationDecayRate * level * 0.5;
motivation -= decayAmount;
// Music bonus
if (musicBonus > 0) {
motivation = Math.min(100, motivation + 0.8);
musicBonus--;
}
// Check game over conditions
if (motivation <= 0) {
LK.getSound('gameOver').play();
LK.showGameOver('Fired!', 'Need a job?');
gameRunning = false;
return;
}
// Level progression
var newLevel = Math.floor(LK.getScore() / 100) + 1;
if (newLevel > level) {
level = newLevel;
motivationDecayRate *= 1.1; // Increase difficulty
}
// Update score
LK.setScore(Math.floor(motivation * 10));
// Reset motivation full tracking if motivation drops below 95
if (motivationWasFull && motivation < 95) {
motivationWasFull = false;
clicksAfterFull = 0;
}
// Update UI
updateMotivationBar();
scoreText.setText('Score: ' + playerScore);
motivationText.setText('Motivation: ' + Math.floor(motivation) + '%');
// Level text update removed
bossAlertText.setText('Boss Alerts: ' + bossAlerts + '/3');
// Boss alert timer
if (bossAlertTimer > 0) {
bossAlertTimer--;
if (bossAlertTimer <= 0 && bossAlertPopup) {
bossAlertPopup.destroy();
bossAlertPopup = null;
}
}
// Spawn bonus buttons
bonusSpawnTimer++;
if (bonusSpawnTimer >= bonusSpawnInterval) {
bonusSpawnTimer = 0;
if (Math.random() < 0.7) {
// 70% chance
spawnBonusButton();
}
}
// Manage click tracking timer
clickTimer++;
if (clickTimer >= clickWindow) {
clickCount = 0; // Reset click count after time window
clickTimer = 0; // Reset timer
}
// Update background based on motivation
if (motivation > 80) {
backgroundMode = 2;
} else if (motivation > 40) {
backgroundMode = 1;
} else {
backgroundMode = 0;
}
updateBackground();
// Win condition
if (LK.getScore() >= 5000) {
LK.getSound('youWin').play();
LK.showYouWin();
gameRunning = false;
}
}; /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var BonusButton = Container.expand(function (type) {
var self = Container.call(this);
self.type = type;
self.isActive = false;
self.lifetime = 5000; // 5 seconds
self.timer = 0;
// Add glow background with type-specific color
var glowAssetName = 'glowEffect';
if (type === 'coffee') {
glowAssetName = 'glowEffectCoffee';
} else if (type === 'music') {
glowAssetName = 'glowEffectMusic';
} else if (type === 'outside') {
glowAssetName = 'glowEffectOutside';
}
var glowBg = self.attachAsset(glowAssetName, {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0
});
glowBg.zIndex = -1;
var buttonAsset;
if (type === 'coffee') {
buttonAsset = self.attachAsset('coffeeButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (type === 'music') {
buttonAsset = self.attachAsset('musicButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (type === 'outside') {
buttonAsset = self.attachAsset('outsideButton', {
anchorX: 0.5,
anchorY: 0.5
});
}
self.activate = function () {
self.isActive = true;
self.timer = 0;
// Start glow effect with more transparent alpha
glowBg.alpha = 0.15;
self.startGlowPulse();
// Popup motion - start small and bounce to larger size
tween(self, {
scaleX: 1.4,
scaleY: 1.4
}, {
duration: 400,
easing: tween.bounceOut
});
// Add a slight bounce back down
tween.stop(self, {
scaleX: true,
scaleY: true
});
LK.setTimeout(function () {
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200,
easing: tween.easeOut
});
}, 400);
};
self.startGlowPulse = function () {
if (!self.isActive) return;
// Pulse the glow with more transparent alpha values
tween(glowBg, {
alpha: 0.35,
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.isActive) {
tween(glowBg, {
alpha: 0.15,
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startGlowPulse();
}
});
}
}
});
};
self.update = function () {
if (self.isActive) {
self.timer += 16; // ~60fps
if (self.timer >= self.lifetime) {
self.deactivate();
}
}
};
self.deactivate = function () {
self.isActive = false;
// Stop glow animation
tween.stop(glowBg);
tween(glowBg, {
alpha: 0
}, {
duration: 300
});
tween(self, {
scaleX: 0,
scaleY: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
};
self.down = function (x, y, obj) {
if (self.isActive) {
bonusUsed++;
playerScore += 10; // Add 10 points for capturing any power-up
if (self.type === 'coffee') {
motivation = Math.min(100, motivation + 15);
LK.getSound('coffee').play();
LK.getSound('coffeeSound').play();
} else if (self.type === 'music') {
motivation = Math.min(100, motivation + 25);
musicBonus = 600; // 10 seconds at 60fps
LK.getSound('buttonClick').play();
LK.getSound('musicSound').play();
} else if (self.type === 'outside') {
motivation = Math.min(100, motivation + 20);
backgroundMode = Math.min(2, backgroundMode + 1);
updateBackground();
LK.getSound('outsideSound').play();
LK.getSound('buttonClick').play();
}
if (bonusUsed >= 3) {
bossAlerts++;
bonusUsed = 0;
showBossAlert();
}
self.deactivate();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x666666
});
/****
* Game Code
****/
var motivation = 50; // 0-100
var motivationDecayRate = 0.1; // per frame
var bossAlerts = 0;
var bonusUsed = 0;
var musicBonus = 0; // frames remaining
var backgroundMode = 0; // 0=gray, 1=mixed, 2=sunny
var level = 0;
var gameRunning = true;
// Start background music
LK.playMusic('backgroundMusic');
var clickCount = 0; // Track clicks in current window
var clickTimer = 0; // Timer to reset click count
var clickThreshold = 30; // Max clicks allowed in time window
var clickWindow = 480; // 8 seconds at 60fps
var motivationWasFull = false; // Track if motivation reached 100
var clicksAfterFull = 0; // Count clicks after motivation reaches 100
var playerScore = 0; // Score from capturing power-ups
// UI Elements
var motivationBarBg = game.addChild(LK.getAsset('motivationBarBg', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 100
}));
var motivationBarFill = game.addChild(LK.getAsset('motivationBarFill', {
anchorX: 0,
anchorY: 0,
x: 725,
y: 101
}));
var background = game.addChild(LK.getAsset('backgroundGray', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
background.zIndex = -1;
// Move background to back manually since sortChildren is not available
game.removeChild(background);
game.addChildAt(background, 0);
// Score and level display
var scoreText = new Text2('Score: 0', {
size: 40,
fill: 0xFFFFFF,
font: "'Arial Black', Arial, sans-serif"
});
scoreText.anchor.set(0, 0);
scoreText.x = 120;
scoreText.y = 20;
game.addChild(scoreText);
// Motivation text above the motivation bar
var motivationText = new Text2('Motivation: 50%', {
size: 40,
fill: 0xFFFFFF,
font: "'Arial Black', Arial, sans-serif"
});
motivationText.anchor.set(0.5, 1);
motivationText.x = 1024;
motivationText.y = 95;
game.addChild(motivationText);
// Level text removed
var bossAlertText = new Text2('Boss Alerts: 0/3', {
size: 30,
fill: 0xFFFF00
});
bossAlertText.anchor.set(1, 0);
bossAlertText.x = 2028;
bossAlertText.y = 20;
game.addChild(bossAlertText);
// Bonus buttons
var bonusButtons = [];
var coffeeBtn = new BonusButton('coffee');
coffeeBtn.x = 300;
coffeeBtn.y = 300;
coffeeBtn.visible = false;
game.addChild(coffeeBtn);
bonusButtons.push(coffeeBtn);
var musicBtn = new BonusButton('music');
musicBtn.x = 1024;
musicBtn.y = 400;
musicBtn.visible = false;
game.addChild(musicBtn);
bonusButtons.push(musicBtn);
var outsideBtn = new BonusButton('outside');
outsideBtn.x = 1700;
outsideBtn.y = 300;
outsideBtn.visible = false;
game.addChild(outsideBtn);
bonusButtons.push(outsideBtn);
// Boss alert popup
var bossAlertPopup = null;
var bossAlertTimer = 0;
var bonusSpawnTimer = 0;
var bonusSpawnInterval = 120; // 2 seconds at 60fps
function updateMotivationBar() {
var fillWidth = motivation / 100 * 598;
motivationBarFill.width = Math.max(0, fillWidth);
// Color coding
if (motivation > 70) {
motivationBarFill.tint = 0x00ff00; // Green
} else if (motivation > 30) {
motivationBarFill.tint = 0xffff00; // Yellow
} else {
motivationBarFill.tint = 0xff0000; // Red
}
}
function updateBackground() {
if (backgroundMode === 0) {
background.tint = 0x666666; // Gray
} else if (backgroundMode === 1) {
background.tint = 0x87CEEB; // Sky blue
} else {
background.tint = 0x90EE90; // Light green
}
}
function showBossAlert() {
if (bossAlertPopup) {
bossAlertPopup.destroy();
}
bossAlertPopup = game.addChild(LK.getAsset('bossAlert', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
var alertText = new Text2('BOSS ALERT!', {
size: 50,
fill: 0xFFFFFF
});
alertText.anchor.set(0.5, 0.5);
bossAlertPopup.addChild(alertText);
LK.getSound('alert').play();
LK.effects.flashScreen(0xff0000, 500);
bossAlertTimer = 180; // 3 seconds
if (bossAlerts >= 3) {
LK.setTimeout(function () {
LK.showGameOver('Fired!', 'Need a job?');
}, 2000);
gameRunning = false;
}
}
function spawnBonusButton() {
var availableButtons = bonusButtons.filter(function (btn) {
return !btn.isActive;
});
if (availableButtons.length > 0) {
var randomBtn = availableButtons[Math.floor(Math.random() * availableButtons.length)];
// Position randomly on screen with some margin from edges
var margin = 100;
randomBtn.x = margin + Math.random() * (2048 - 2 * margin);
randomBtn.y = margin + Math.random() * (2732 - 2 * margin);
randomBtn.visible = true;
randomBtn.scaleX = 0;
randomBtn.scaleY = 0;
randomBtn.activate();
}
}
// Main tap area
game.down = function (x, y, obj) {
if (gameRunning) {
motivation = Math.min(100, motivation + 5);
LK.getSound('buttonClick').play();
LK.getSound('motivationUp').play();
// Check if motivation reached full
if (motivation >= 100 && !motivationWasFull) {
motivationWasFull = true;
clicksAfterFull = 0; // Reset counter when reaching full
}
// Track clicks for boss alert system - only after motivation was full
if (motivationWasFull) {
clicksAfterFull++;
if (clicksAfterFull >= 5) {
bossAlerts++;
clicksAfterFull = 0; // Reset after triggering alert
showBossAlert();
}
} else {
// Original click tracking system for backwards compatibility
clickCount++;
if (clickCount >= clickThreshold) {
bossAlerts++;
clickCount = 0; // Reset after triggering alert
clickTimer = 0; // Reset timer
showBossAlert();
}
}
// Visual feedback
tween(game, {
scaleX: 1.02,
scaleY: 1.02
}, {
duration: 100,
onFinish: function onFinish() {
tween(game, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
}
};
game.update = function () {
if (!gameRunning) return;
// Decay motivation
var decayAmount = motivationDecayRate * level * 0.5;
motivation -= decayAmount;
// Music bonus
if (musicBonus > 0) {
motivation = Math.min(100, motivation + 0.8);
musicBonus--;
}
// Check game over conditions
if (motivation <= 0) {
LK.getSound('gameOver').play();
LK.showGameOver('Fired!', 'Need a job?');
gameRunning = false;
return;
}
// Level progression
var newLevel = Math.floor(LK.getScore() / 100) + 1;
if (newLevel > level) {
level = newLevel;
motivationDecayRate *= 1.1; // Increase difficulty
}
// Update score
LK.setScore(Math.floor(motivation * 10));
// Reset motivation full tracking if motivation drops below 95
if (motivationWasFull && motivation < 95) {
motivationWasFull = false;
clicksAfterFull = 0;
}
// Update UI
updateMotivationBar();
scoreText.setText('Score: ' + playerScore);
motivationText.setText('Motivation: ' + Math.floor(motivation) + '%');
// Level text update removed
bossAlertText.setText('Boss Alerts: ' + bossAlerts + '/3');
// Boss alert timer
if (bossAlertTimer > 0) {
bossAlertTimer--;
if (bossAlertTimer <= 0 && bossAlertPopup) {
bossAlertPopup.destroy();
bossAlertPopup = null;
}
}
// Spawn bonus buttons
bonusSpawnTimer++;
if (bonusSpawnTimer >= bonusSpawnInterval) {
bonusSpawnTimer = 0;
if (Math.random() < 0.7) {
// 70% chance
spawnBonusButton();
}
}
// Manage click tracking timer
clickTimer++;
if (clickTimer >= clickWindow) {
clickCount = 0; // Reset click count after time window
clickTimer = 0; // Reset timer
}
// Update background based on motivation
if (motivation > 80) {
backgroundMode = 2;
} else if (motivation > 40) {
backgroundMode = 1;
} else {
backgroundMode = 0;
}
updateBackground();
// Win condition
if (LK.getScore() >= 5000) {
LK.getSound('youWin').play();
LK.showYouWin();
gameRunning = false;
}
};