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;
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
});
}
var label = new Text2(type.toUpperCase(), {
size: 20,
fill: 0xFFFFFF
});
label.anchor.set(0.5, 0.5);
self.addChild(label);
self.activate = function () {
self.isActive = true;
self.timer = 0;
tween(self, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.bounceOut
});
};
self.update = function () {
if (self.isActive) {
self.timer += 16; // ~60fps
if (self.timer >= self.lifetime) {
self.deactivate();
}
}
};
self.deactivate = function () {
self.isActive = false;
tween(self, {
scaleX: 0,
scaleY: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
};
self.down = function (x, y, obj) {
if (self.isActive) {
bonusUsed++;
if (self.type === 'coffee') {
motivation = Math.min(100, motivation + 10);
LK.getSound('coffee').play();
} else if (self.type === 'music') {
musicBonus = 600; // 10 seconds at 60fps
LK.getSound('click').play();
} else if (self.type === 'outside') {
motivation = Math.min(100, motivation + 5);
backgroundMode = Math.min(2, backgroundMode + 1);
updateBackground();
LK.getSound('click').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 = 1;
var gameRunning = true;
// 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;
game.sortChildren();
// Score and level display
var scoreText = new Text2('Motivation: 50%', {
size: 40,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var levelText = new Text2('Level: 1', {
size: 30,
fill: 0xFFFFFF
});
levelText.anchor.set(0, 0);
levelText.x = 20;
levelText.y = 20;
game.addChild(levelText);
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 = 300; // 5 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();
}, 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)];
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 + 2);
LK.getSound('click').play();
// 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.3);
musicBonus--;
}
// Check game over conditions
if (motivation <= 0) {
LK.showGameOver();
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));
// Update UI
updateMotivationBar();
scoreText.setText('Motivation: ' + Math.floor(motivation) + '%');
levelText.setText('Level: ' + level);
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.4) {
// 40% chance
spawnBonusButton();
}
}
// 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.showYouWin();
gameRunning = false;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,323 @@
-/****
+/****
+* 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;
+ 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
+ });
+ }
+ var label = new Text2(type.toUpperCase(), {
+ size: 20,
+ fill: 0xFFFFFF
+ });
+ label.anchor.set(0.5, 0.5);
+ self.addChild(label);
+ self.activate = function () {
+ self.isActive = true;
+ self.timer = 0;
+ tween(self, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 200,
+ easing: tween.bounceOut
+ });
+ };
+ self.update = function () {
+ if (self.isActive) {
+ self.timer += 16; // ~60fps
+ if (self.timer >= self.lifetime) {
+ self.deactivate();
+ }
+ }
+ };
+ self.deactivate = function () {
+ self.isActive = false;
+ tween(self, {
+ scaleX: 0,
+ scaleY: 0
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.visible = false;
+ }
+ });
+ };
+ self.down = function (x, y, obj) {
+ if (self.isActive) {
+ bonusUsed++;
+ if (self.type === 'coffee') {
+ motivation = Math.min(100, motivation + 10);
+ LK.getSound('coffee').play();
+ } else if (self.type === 'music') {
+ musicBonus = 600; // 10 seconds at 60fps
+ LK.getSound('click').play();
+ } else if (self.type === 'outside') {
+ motivation = Math.min(100, motivation + 5);
+ backgroundMode = Math.min(2, backgroundMode + 1);
+ updateBackground();
+ LK.getSound('click').play();
+ }
+ if (bonusUsed >= 3) {
+ bossAlerts++;
+ bonusUsed = 0;
+ showBossAlert();
+ }
+ self.deactivate();
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ 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 = 1;
+var gameRunning = true;
+// 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;
+game.sortChildren();
+// Score and level display
+var scoreText = new Text2('Motivation: 50%', {
+ size: 40,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreText);
+var levelText = new Text2('Level: 1', {
+ size: 30,
+ fill: 0xFFFFFF
+});
+levelText.anchor.set(0, 0);
+levelText.x = 20;
+levelText.y = 20;
+game.addChild(levelText);
+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 = 300; // 5 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();
+ }, 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)];
+ 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 + 2);
+ LK.getSound('click').play();
+ // 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.3);
+ musicBonus--;
+ }
+ // Check game over conditions
+ if (motivation <= 0) {
+ LK.showGameOver();
+ 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));
+ // Update UI
+ updateMotivationBar();
+ scoreText.setText('Motivation: ' + Math.floor(motivation) + '%');
+ levelText.setText('Level: ' + level);
+ 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.4) {
+ // 40% chance
+ spawnBonusButton();
+ }
+ }
+ // 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.showYouWin();
+ gameRunning = false;
+ }
+};
\ No newline at end of file