Code edit (12 edits merged)
Please save this source code
User prompt
make the background of the clock transparent
User prompt
The clock frame is a circle !
User prompt
Update clock. The shape is a circle !
User prompt
It's not a square It's round. There are four sigs like in a cloc
User prompt
It's round and the indicators move rapidly !
User prompt
ON the background create a round object that has two indicators and looks like a clock and the indicators move ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Nothing changed !
User prompt
Move the stress level bar in the top middle.
User prompt
Show the number of the level next to the level. Now it also shows a number under the level. Remove that.
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'fill')' in or related to this line: 'self.statusText.style.fill = 0x000000;' Line Number: 46
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'x')' in or related to this line: 'self.statusText.x = self.player.x;' Line Number: 41
Code edit (2 edits merged)
Please save this source code
User prompt
Move the players status to be in the midles o fthe screen
User prompt
Move the I'm fine text to be in the middle of the screen !
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'elf is not defined' in or related to this line: 'elf.statusText.y = 50;' Line Number: 36
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in or related to this line: 'if (Math.random() < 0.001 && typeof stressLevel === 'number' && stressLevel > 0) {' Line Number: 604
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in or related to this line: 'if (Math.random() < 0.001 && stressLevel !== null && stressLevel !== undefined && stressLevel > 0) {' Line Number: 604
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in or related to this line: 'if (Math.random() < 0.001 && typeof stressLevel !== 'undefined' && stressLevel > 0) {' Line Number: 604
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Player = Container.expand(function () { var self = Container.call(this); var playerGraphic = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Create status text once self.statusText = new Text2("I'm fine!", { size: 40, fill: 0x000000 }); // Initialize the style object properly self.statusText.style = { fill: 0x000000, fontSize: 40 }; self.statusText.anchor.set(0.5, -0.5); self.addChild(self.statusText); // Update appearance based on stress level self.updateAppearance = function (stress) { // Visual changes based on stress if (stress < 30) { playerGraphic.tint = 0x3498db; // Normal blue self.statusText.setText("I'm fine!"); self.statusText.style.fill = 0x000000; self.statusText.style.fontSize = 40; tween.stop(self); tween(self, { rotation: 0, scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeOut }); } else if (stress < 60) { playerGraphic.tint = 0x9b59b6; // Purple - getting stressed self.statusText.setText("I'm FINE!"); self.statusText.style.fill = 0x660000; self.statusText.style.fontSize = 45; tween.stop(self); tween(self, { rotation: 0, scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeOut }); } else if (stress < 90) { playerGraphic.tint = 0xe74c3c; // Red - very stressed self.statusText.setText("I'M FINE!!"); self.statusText.style.fill = 0xFF0000; self.statusText.style.fontSize = 50; // Add slight wobble tween.stop(self); tween(self, { rotation: 0.05 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { rotation: -0.05 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { if (stressLevel >= 60) { self.updateAppearance(stressLevel); } } }); } }); } else { playerGraphic.tint = 0xff0000; // Bright red - about to lose it self.statusText.setText("I'M FINE!!!"); self.statusText.style.fill = 0xFF0000; self.statusText.style.fontSize = 55; // Add more dramatic wobble tween.stop(self); tween(self, { rotation: 0.1, scaleX: 1.1, scaleY: 0.9 }, { duration: 200, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { rotation: -0.1, scaleX: 0.9, scaleY: 1.1 }, { duration: 200, easing: tween.easeInOut, onFinish: function onFinish() { if (stressLevel >= 90) { self.updateAppearance(stressLevel); } } }); } }); } }; return self; }); var Problem = Container.expand(function () { var self = Container.call(this); // Different problem types with text and color var problemTypes = [{ text: "WiFi Down!", color: 0xff4d4d }, { text: "Coffee Spill!", color: 0x8b4513 }, { text: "Deadline Changed!", color: 0xff9900 }, { text: "Surprise Meeting!", color: 0x9933cc }, { text: "Traffic Jam!", color: 0x666666 }, { text: "Phone Died!", color: 0x000000 }, { text: "Email Overload!", color: 0x3366ff }, { text: "Printer Error!", color: 0xcc0000 }, { text: "Noisy Neighbors!", color: 0x99cc00 }, { text: "Low Battery!", color: 0xff6600 }]; // Choose random problem type var typeIndex = Math.floor(Math.random() * problemTypes.length); var type = problemTypes[typeIndex]; // Create problem visual var problemGraphic = self.attachAsset('problem', { anchorX: 0.5, anchorY: 0.5, tint: type.color }); // Add problem text var problemText = new Text2(type.text, { size: 24, fill: 0xFFFFFF, align: 'center', wordWrap: true, wordWrapWidth: 130 }); problemText.anchor.set(0.5, 0.5); self.addChild(problemText); // Problem properties self.fallSpeed = 2 + Math.random() * 3; self.rotationSpeed = (Math.random() - 0.5) * 0.05; self.stressValue = Math.ceil(Math.random() * 3); self.active = true; // Handle tap self.down = function (x, y, obj) { if (!self.active) return; self.active = false; LK.getSound('tap').play(); // Tween to make it disappear tween(self, { alpha: 0, scaleX: 0.2, scaleY: 0.2 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); // Award more points at higher levels if (gameLevel < 10) { score += 1; } else { score += 2; } scoreText.setText("SCORE: " + score); }; // Update method called each frame self.update = function () { if (!self.active) return; // Move problem downward self.y += self.fallSpeed; self.rotation += self.rotationSpeed; // Check if problem hit the floor if (self.y > 2732) { stressLevel += self.stressValue; updateStressBar(); LK.getSound('stress').play(); // Visual feedback LK.effects.flashScreen(0xff0000, 200, 0.3); self.destroy(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xe8f4f8 // Light blue background }); /**** * Game Code ****/ // Game state variables // Replace with actual ID // Replace with actual ID // Replace with actual ID // Replace with actual ID // Replace with actual ID // Replace with actual ID var score = 0; var stressLevel = 0; var gameLevel = 1; var problems = []; var problemSpawnTime = 2000; // ms var lastProblemTime = 0; var player; var scoreText; var levelText; var progressBarBackground; var progressBarFill; var gameRunning = true; // Set up background var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); game.addChild(background); // Set up player player = new Player(); player.x = 2048 / 2; player.y = 2732 - 300; game.addChild(player); // Set up score text scoreText = new Text2("SCORE: 0", { size: 60, fill: 0x000000 }); scoreText.anchor.set(0.5, 0); scoreText.x = 2048 / 2; scoreText.y = 20; LK.gui.top.addChild(scoreText); // Set up level text levelText = new Text2("LEVEL: 1", { size: 40, fill: 0x000000 }); levelText.anchor.set(0, 0); levelText.x = 150; // Leave space for the top-left menu icon levelText.y = 50; LK.gui.addChild(levelText); // Game title var titleText = new Text2("I'M FINE!", { size: 70, fill: 0xff4d4d, fontWeight: 'bold' }); titleText.anchor.set(1, 0); titleText.x = 2048 - 150; titleText.y = 50; LK.gui.addChild(titleText); // Stress bar - positioned at bottom middle with rounded corners progressBarBackground = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 100, // Position near bottom of screen tint: 0xcccccc, alpha: 0.8 }); // Add rounded corners with mask var barMask = new Container(); var cornerRadius = 25; // Radius for rounded corners var barWidth = 1000; var barHeight = 50; // Top left corner var topLeft = LK.getAsset('centerCircle', { anchorX: 0, anchorY: 0, width: cornerRadius * 2, height: cornerRadius * 2, x: 0, y: 0 }); barMask.addChild(topLeft); // Top right corner var topRight = LK.getAsset('centerCircle', { anchorX: 0, anchorY: 0, width: cornerRadius * 2, height: cornerRadius * 2, x: barWidth - cornerRadius * 2, y: 0 }); barMask.addChild(topRight); // Bottom left corner var bottomLeft = LK.getAsset('centerCircle', { anchorX: 0, anchorY: 0, width: cornerRadius * 2, height: cornerRadius * 2, x: 0, y: barHeight - cornerRadius * 2 }); barMask.addChild(bottomLeft); // Bottom right corner var bottomRight = LK.getAsset('centerCircle', { anchorX: 0, anchorY: 0, width: cornerRadius * 2, height: cornerRadius * 2, x: barWidth - cornerRadius * 2, y: barHeight - cornerRadius * 2 }); barMask.addChild(bottomRight); // Horizontal rectangles var topRect = LK.getAsset('progressBar', { anchorX: 0, anchorY: 0, width: barWidth - cornerRadius * 2, height: cornerRadius, x: cornerRadius, y: 0 }); barMask.addChild(topRect); var bottomRect = LK.getAsset('progressBar', { anchorX: 0, anchorY: 0, width: barWidth - cornerRadius * 2, height: cornerRadius, x: cornerRadius, y: barHeight - cornerRadius }); barMask.addChild(bottomRect); // Vertical rectangles var leftRect = LK.getAsset('progressBar', { anchorX: 0, anchorY: 0, width: cornerRadius, height: barHeight - cornerRadius * 2, x: 0, y: cornerRadius }); barMask.addChild(leftRect); var rightRect = LK.getAsset('progressBar', { anchorX: 0, anchorY: 0, width: cornerRadius, height: barHeight - cornerRadius * 2, x: barWidth - cornerRadius, y: cornerRadius }); barMask.addChild(rightRect); // Center rectangle var centerRect = LK.getAsset('progressBar', { anchorX: 0, anchorY: 0, width: barWidth - cornerRadius * 2, height: barHeight - cornerRadius * 2, x: cornerRadius, y: cornerRadius }); barMask.addChild(centerRect); barMask.x = progressBarBackground.x - barWidth / 2; barMask.y = progressBarBackground.y - barHeight / 2; LK.gui.addChild(barMask); progressBarBackground.mask = barMask; LK.gui.addChild(progressBarBackground); progressBarFill = LK.getAsset('progressFill', { anchorX: 0, anchorY: 0.5, x: (2048 - 1000) / 2, y: 2732 - 100, width: 0, // Start with 0 width tint: 0xff4d4d }); // Create fill mask with same rounded corners var fillMask = new Container(); // Properly recreate the mask instead of trying to clone it var fillBarMask = new Container(); // Copy all the children from barMask to fillBarMask for (var i = 0; i < barMask.children.length; i++) { var child = barMask.children[i]; // Create a new instance of the same asset with same properties var newChild = LK.getAsset(child.assetId || 'progressBar', { anchorX: child.anchor ? child.anchor.x : 0, anchorY: child.anchor ? child.anchor.y : 0, width: child.width, height: child.height, x: child.x, y: child.y, tint: child.tint || 0xffffff }); fillBarMask.addChild(newChild); } fillMask.addChild(fillBarMask); fillMask.x = progressBarFill.x; fillMask.y = progressBarFill.y - barHeight / 2; LK.gui.addChild(fillMask); progressBarFill.mask = fillMask; LK.gui.addChild(progressBarFill); // Status label var statusLabel = new Text2("STRESS LEVEL", { size: 30, fill: 0xFFFFFF, stroke: 0x000000, strokeThickness: 2 }); statusLabel.anchor.set(0.5, 1); statusLabel.x = 2048 / 2; statusLabel.y = progressBarBackground.y - 35; LK.gui.addChild(statusLabel); // Update stress bar based on current stress level function updateStressBar() { // Update stress bar width based on stress level var maxWidth = 1000; var newWidth = stressLevel / 100 * maxWidth; // Tween the progress bar fill tween(progressBarFill, { width: newWidth }, { duration: 300, easing: tween.easeOut }); // Update player appearance based on stress player.updateAppearance(stressLevel); // Game over if stress level reaches 100 if (stressLevel >= 100 && gameRunning) { gameRunning = false; LK.effects.flashScreen(0xff0000, 1000); // Create game over text var gameOverText = new Text2("YOU'RE NOT FINE!", { size: 100, fill: 0xff0000, stroke: 0xffffff, strokeThickness: 5 }); gameOverText.anchor.set(0.5, 0.5); gameOverText.x = 2048 / 2; gameOverText.y = 2732 / 2 - 200; // Add fun meme text var memeText = new Text2("(But we've all been there...)", { size: 50, fill: 0xffffff }); memeText.anchor.set(0.5, 0.5); memeText.x = 2048 / 2; memeText.y = 2732 / 2 - 100; LK.gui.addChild(gameOverText); LK.gui.addChild(memeText); LK.setTimeout(function () { LK.showGameOver(); }, 3000); } } // Spawn a new problem function spawnProblem() { var problem = new Problem(); problem.x = Math.random() * (2048 - 200) + 100; // Random x position problem.y = -100; // Start above screen game.addChild(problem); problems.push(problem); } // Check if level should be increased based on score function checkLevelProgress() { // Level up based on score var newLevel = Math.floor(score / 10) + 1; if (newLevel > gameLevel) { gameLevel = newLevel; levelText.setText("LEVEL: " + gameLevel); // Make problems spawn faster as level increases problemSpawnTime = Math.max(500, 2000 - gameLevel * 150); // Visual and audio feedback for level up LK.effects.flashScreen(0x00ff00, 500, 0.3); LK.getSound('levelup').play(); // Show level up text var levelUpText = new Text2("LEVEL UP!", { size: 80, fill: 0x00cc00 }); levelUpText.anchor.set(0.5, 0.5); levelUpText.x = 2048 / 2; levelUpText.y = 2732 / 2; LK.gui.addChild(levelUpText); // Animate and remove text tween(levelUpText, { scaleX: 1.5, scaleY: 1.5, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { levelUpText.destroy(); } }); } } // Clean up problems that have been destroyed function cleanupProblems() { for (var i = problems.length - 1; i >= 0; i--) { if (!problems[i].parent) { problems.splice(i, 1); } } } // Spawn tutorial text at start function showTutorial() { var tutorialText = new Text2("TAP THE PROBLEMS BEFORE THEY HIT THE GROUND!", { size: 60, fill: 0xffffff, align: 'center', wordWrap: true, wordWrapWidth: 1800, stroke: 0x000000, strokeThickness: 5 }); tutorialText.anchor.set(0.5, 0.5); tutorialText.x = 2048 / 2; tutorialText.y = 2732 / 2; LK.gui.addChild(tutorialText); LK.setTimeout(function () { tween(tutorialText, { alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { tutorialText.destroy(); } }); }, 3000); } // Show tutorial at start showTutorial(); // Game update function game.update = function () { if (!gameRunning) { return; } // Check if it's time to spawn a new problem if (LK.ticks * (1000 / 60) - lastProblemTime > problemSpawnTime) { spawnProblem(); lastProblemTime = LK.ticks * (1000 / 60); } // Update all problems for (var i = 0; i < problems.length; i++) { problems[i].update(); } // Check if player should level up checkLevelProgress(); // Clean up any destroyed problems cleanupProblems(); // Randomly reduce stress by a small amount (chance for slight recovery) if (Math.random() < 0.001 && stressLevel !== null && stressLevel !== undefined && stressLevel > 0) { stressLevel = Math.max(0, stressLevel - 1); updateStressBar(); } }; // Add shake effect to entire game when stress is high LK.setInterval(function () { if (stressLevel >= 70 && gameRunning) { var intensity = (stressLevel - 70) / 30; // 0 to 1 based on stress from 70-100 var shake = 10 * intensity; tween(game, { x: Math.random() * shake - shake / 2 }, { duration: 50, easing: tween.linear, onFinish: function onFinish() { tween(game, { x: 0 }, { duration: 50, easing: tween.linear }); } }); } }, 1000); // Initial stress bar update updateStressBar(); // Start the music LK.playMusic('bgmusic'); // Add instructions button var instructionsButton = new Container(); // Use LK.getAsset instead of Graphics for the button background var instructionsButtonBg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 60, height: 60, tint: 0x333333, alpha: 0.7 }); instructionsButtonBg.x = 30; instructionsButtonBg.y = 30; instructionsButton.addChild(instructionsButtonBg); var questionText = new Text2("?", { size: 40, fill: 0xffffff }); questionText.anchor.set(0.5, 0.5); questionText.x = 30; questionText.y = 30; instructionsButton.addChild(questionText); instructionsButton.x = 50; instructionsButton.y = 50; instructionsButton.interactive = true; LK.gui.addChild(instructionsButton); instructionsButton.down = function () { // Show instructions popup var popup = new Container(); // Darken background using a shape asset instead of Graphics var bg = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, tint: 0x000000, alpha: 0.7 }); bg.x = 2048 / 2; bg.y = 2732 / 2; popup.addChild(bg); // Instructions panel using a shape asset instead of Graphics var panel = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, width: 1500, height: 1000, tint: 0xffffff, alpha: 0.9 }); panel.x = 2048 / 2; panel.y = 2732 / 2; popup.addChild(panel); // Title var title = new Text2("HOW TO PLAY", { size: 80, fill: 0xff4d4d, fontWeight: 'bold' }); title.anchor.set(0.5, 0); title.x = panel.x; title.y = panel.y - 400; popup.addChild(title); // Instructions var instructions = new Text2("1. Tap on the falling problems before they hit the ground\n\n" + "2. Each problem that hits the ground increases your stress\n\n" + "3. Don't let your stress meter reach 100%\n\n" + "4. Score points by tapping problems\n\n" + "5. Level up every 10 points\n\n" + "6. Higher levels = faster problems\n\n" + "7. Just keep telling yourself, \"I'M FINE!\"", { size: 50, fill: 0x000000, align: 'left', lineHeight: 60 }); instructions.anchor.set(0.5, 0); instructions.x = panel.x; instructions.y = panel.y - 300; popup.addChild(instructions); // Close button var closeButton = new Container(); var closeBg = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 100, tint: 0xff4d4d }); closeButton.addChild(closeBg); var closeText = new Text2("CLOSE", { size: 50, fill: 0xffffff }); closeText.anchor.set(0.5, 0.5); closeText.x = 0; closeText.y = 0; closeButton.addChild(closeText); closeButton.x = panel.x; closeButton.y = panel.y + 350; closeButton.interactive = true; popup.addChild(closeButton); closeButton.down = function () { popup.destroy(); }; LK.gui.addChild(popup); };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphic = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
// Create status text once
self.statusText = new Text2("I'm fine!", {
size: 40,
fill: 0x000000
});
// Initialize the style object properly
self.statusText.style = {
fill: 0x000000,
fontSize: 40
};
self.statusText.anchor.set(0.5, -0.5);
self.addChild(self.statusText);
// Update appearance based on stress level
self.updateAppearance = function (stress) {
// Visual changes based on stress
if (stress < 30) {
playerGraphic.tint = 0x3498db; // Normal blue
self.statusText.setText("I'm fine!");
self.statusText.style.fill = 0x000000;
self.statusText.style.fontSize = 40;
tween.stop(self);
tween(self, {
rotation: 0,
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.easeOut
});
} else if (stress < 60) {
playerGraphic.tint = 0x9b59b6; // Purple - getting stressed
self.statusText.setText("I'm FINE!");
self.statusText.style.fill = 0x660000;
self.statusText.style.fontSize = 45;
tween.stop(self);
tween(self, {
rotation: 0,
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.easeOut
});
} else if (stress < 90) {
playerGraphic.tint = 0xe74c3c; // Red - very stressed
self.statusText.setText("I'M FINE!!");
self.statusText.style.fill = 0xFF0000;
self.statusText.style.fontSize = 50;
// Add slight wobble
tween.stop(self);
tween(self, {
rotation: 0.05
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
rotation: -0.05
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (stressLevel >= 60) {
self.updateAppearance(stressLevel);
}
}
});
}
});
} else {
playerGraphic.tint = 0xff0000; // Bright red - about to lose it
self.statusText.setText("I'M FINE!!!");
self.statusText.style.fill = 0xFF0000;
self.statusText.style.fontSize = 55;
// Add more dramatic wobble
tween.stop(self);
tween(self, {
rotation: 0.1,
scaleX: 1.1,
scaleY: 0.9
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
rotation: -0.1,
scaleX: 0.9,
scaleY: 1.1
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (stressLevel >= 90) {
self.updateAppearance(stressLevel);
}
}
});
}
});
}
};
return self;
});
var Problem = Container.expand(function () {
var self = Container.call(this);
// Different problem types with text and color
var problemTypes = [{
text: "WiFi Down!",
color: 0xff4d4d
}, {
text: "Coffee Spill!",
color: 0x8b4513
}, {
text: "Deadline Changed!",
color: 0xff9900
}, {
text: "Surprise Meeting!",
color: 0x9933cc
}, {
text: "Traffic Jam!",
color: 0x666666
}, {
text: "Phone Died!",
color: 0x000000
}, {
text: "Email Overload!",
color: 0x3366ff
}, {
text: "Printer Error!",
color: 0xcc0000
}, {
text: "Noisy Neighbors!",
color: 0x99cc00
}, {
text: "Low Battery!",
color: 0xff6600
}];
// Choose random problem type
var typeIndex = Math.floor(Math.random() * problemTypes.length);
var type = problemTypes[typeIndex];
// Create problem visual
var problemGraphic = self.attachAsset('problem', {
anchorX: 0.5,
anchorY: 0.5,
tint: type.color
});
// Add problem text
var problemText = new Text2(type.text, {
size: 24,
fill: 0xFFFFFF,
align: 'center',
wordWrap: true,
wordWrapWidth: 130
});
problemText.anchor.set(0.5, 0.5);
self.addChild(problemText);
// Problem properties
self.fallSpeed = 2 + Math.random() * 3;
self.rotationSpeed = (Math.random() - 0.5) * 0.05;
self.stressValue = Math.ceil(Math.random() * 3);
self.active = true;
// Handle tap
self.down = function (x, y, obj) {
if (!self.active) return;
self.active = false;
LK.getSound('tap').play();
// Tween to make it disappear
tween(self, {
alpha: 0,
scaleX: 0.2,
scaleY: 0.2
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
// Award more points at higher levels
if (gameLevel < 10) {
score += 1;
} else {
score += 2;
}
scoreText.setText("SCORE: " + score);
};
// Update method called each frame
self.update = function () {
if (!self.active) return;
// Move problem downward
self.y += self.fallSpeed;
self.rotation += self.rotationSpeed;
// Check if problem hit the floor
if (self.y > 2732) {
stressLevel += self.stressValue;
updateStressBar();
LK.getSound('stress').play();
// Visual feedback
LK.effects.flashScreen(0xff0000, 200, 0.3);
self.destroy();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xe8f4f8 // Light blue background
});
/****
* Game Code
****/
// Game state variables
// Replace with actual ID
// Replace with actual ID
// Replace with actual ID
// Replace with actual ID
// Replace with actual ID
// Replace with actual ID
var score = 0;
var stressLevel = 0;
var gameLevel = 1;
var problems = [];
var problemSpawnTime = 2000; // ms
var lastProblemTime = 0;
var player;
var scoreText;
var levelText;
var progressBarBackground;
var progressBarFill;
var gameRunning = true;
// Set up background
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(background);
// Set up player
player = new Player();
player.x = 2048 / 2;
player.y = 2732 - 300;
game.addChild(player);
// Set up score text
scoreText = new Text2("SCORE: 0", {
size: 60,
fill: 0x000000
});
scoreText.anchor.set(0.5, 0);
scoreText.x = 2048 / 2;
scoreText.y = 20;
LK.gui.top.addChild(scoreText);
// Set up level text
levelText = new Text2("LEVEL: 1", {
size: 40,
fill: 0x000000
});
levelText.anchor.set(0, 0);
levelText.x = 150; // Leave space for the top-left menu icon
levelText.y = 50;
LK.gui.addChild(levelText);
// Game title
var titleText = new Text2("I'M FINE!", {
size: 70,
fill: 0xff4d4d,
fontWeight: 'bold'
});
titleText.anchor.set(1, 0);
titleText.x = 2048 - 150;
titleText.y = 50;
LK.gui.addChild(titleText);
// Stress bar - positioned at bottom middle with rounded corners
progressBarBackground = LK.getAsset('progressBar', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 - 100,
// Position near bottom of screen
tint: 0xcccccc,
alpha: 0.8
});
// Add rounded corners with mask
var barMask = new Container();
var cornerRadius = 25; // Radius for rounded corners
var barWidth = 1000;
var barHeight = 50;
// Top left corner
var topLeft = LK.getAsset('centerCircle', {
anchorX: 0,
anchorY: 0,
width: cornerRadius * 2,
height: cornerRadius * 2,
x: 0,
y: 0
});
barMask.addChild(topLeft);
// Top right corner
var topRight = LK.getAsset('centerCircle', {
anchorX: 0,
anchorY: 0,
width: cornerRadius * 2,
height: cornerRadius * 2,
x: barWidth - cornerRadius * 2,
y: 0
});
barMask.addChild(topRight);
// Bottom left corner
var bottomLeft = LK.getAsset('centerCircle', {
anchorX: 0,
anchorY: 0,
width: cornerRadius * 2,
height: cornerRadius * 2,
x: 0,
y: barHeight - cornerRadius * 2
});
barMask.addChild(bottomLeft);
// Bottom right corner
var bottomRight = LK.getAsset('centerCircle', {
anchorX: 0,
anchorY: 0,
width: cornerRadius * 2,
height: cornerRadius * 2,
x: barWidth - cornerRadius * 2,
y: barHeight - cornerRadius * 2
});
barMask.addChild(bottomRight);
// Horizontal rectangles
var topRect = LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0,
width: barWidth - cornerRadius * 2,
height: cornerRadius,
x: cornerRadius,
y: 0
});
barMask.addChild(topRect);
var bottomRect = LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0,
width: barWidth - cornerRadius * 2,
height: cornerRadius,
x: cornerRadius,
y: barHeight - cornerRadius
});
barMask.addChild(bottomRect);
// Vertical rectangles
var leftRect = LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0,
width: cornerRadius,
height: barHeight - cornerRadius * 2,
x: 0,
y: cornerRadius
});
barMask.addChild(leftRect);
var rightRect = LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0,
width: cornerRadius,
height: barHeight - cornerRadius * 2,
x: barWidth - cornerRadius,
y: cornerRadius
});
barMask.addChild(rightRect);
// Center rectangle
var centerRect = LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0,
width: barWidth - cornerRadius * 2,
height: barHeight - cornerRadius * 2,
x: cornerRadius,
y: cornerRadius
});
barMask.addChild(centerRect);
barMask.x = progressBarBackground.x - barWidth / 2;
barMask.y = progressBarBackground.y - barHeight / 2;
LK.gui.addChild(barMask);
progressBarBackground.mask = barMask;
LK.gui.addChild(progressBarBackground);
progressBarFill = LK.getAsset('progressFill', {
anchorX: 0,
anchorY: 0.5,
x: (2048 - 1000) / 2,
y: 2732 - 100,
width: 0,
// Start with 0 width
tint: 0xff4d4d
});
// Create fill mask with same rounded corners
var fillMask = new Container();
// Properly recreate the mask instead of trying to clone it
var fillBarMask = new Container();
// Copy all the children from barMask to fillBarMask
for (var i = 0; i < barMask.children.length; i++) {
var child = barMask.children[i];
// Create a new instance of the same asset with same properties
var newChild = LK.getAsset(child.assetId || 'progressBar', {
anchorX: child.anchor ? child.anchor.x : 0,
anchorY: child.anchor ? child.anchor.y : 0,
width: child.width,
height: child.height,
x: child.x,
y: child.y,
tint: child.tint || 0xffffff
});
fillBarMask.addChild(newChild);
}
fillMask.addChild(fillBarMask);
fillMask.x = progressBarFill.x;
fillMask.y = progressBarFill.y - barHeight / 2;
LK.gui.addChild(fillMask);
progressBarFill.mask = fillMask;
LK.gui.addChild(progressBarFill);
// Status label
var statusLabel = new Text2("STRESS LEVEL", {
size: 30,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 2
});
statusLabel.anchor.set(0.5, 1);
statusLabel.x = 2048 / 2;
statusLabel.y = progressBarBackground.y - 35;
LK.gui.addChild(statusLabel);
// Update stress bar based on current stress level
function updateStressBar() {
// Update stress bar width based on stress level
var maxWidth = 1000;
var newWidth = stressLevel / 100 * maxWidth;
// Tween the progress bar fill
tween(progressBarFill, {
width: newWidth
}, {
duration: 300,
easing: tween.easeOut
});
// Update player appearance based on stress
player.updateAppearance(stressLevel);
// Game over if stress level reaches 100
if (stressLevel >= 100 && gameRunning) {
gameRunning = false;
LK.effects.flashScreen(0xff0000, 1000);
// Create game over text
var gameOverText = new Text2("YOU'RE NOT FINE!", {
size: 100,
fill: 0xff0000,
stroke: 0xffffff,
strokeThickness: 5
});
gameOverText.anchor.set(0.5, 0.5);
gameOverText.x = 2048 / 2;
gameOverText.y = 2732 / 2 - 200;
// Add fun meme text
var memeText = new Text2("(But we've all been there...)", {
size: 50,
fill: 0xffffff
});
memeText.anchor.set(0.5, 0.5);
memeText.x = 2048 / 2;
memeText.y = 2732 / 2 - 100;
LK.gui.addChild(gameOverText);
LK.gui.addChild(memeText);
LK.setTimeout(function () {
LK.showGameOver();
}, 3000);
}
}
// Spawn a new problem
function spawnProblem() {
var problem = new Problem();
problem.x = Math.random() * (2048 - 200) + 100; // Random x position
problem.y = -100; // Start above screen
game.addChild(problem);
problems.push(problem);
}
// Check if level should be increased based on score
function checkLevelProgress() {
// Level up based on score
var newLevel = Math.floor(score / 10) + 1;
if (newLevel > gameLevel) {
gameLevel = newLevel;
levelText.setText("LEVEL: " + gameLevel);
// Make problems spawn faster as level increases
problemSpawnTime = Math.max(500, 2000 - gameLevel * 150);
// Visual and audio feedback for level up
LK.effects.flashScreen(0x00ff00, 500, 0.3);
LK.getSound('levelup').play();
// Show level up text
var levelUpText = new Text2("LEVEL UP!", {
size: 80,
fill: 0x00cc00
});
levelUpText.anchor.set(0.5, 0.5);
levelUpText.x = 2048 / 2;
levelUpText.y = 2732 / 2;
LK.gui.addChild(levelUpText);
// Animate and remove text
tween(levelUpText, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
levelUpText.destroy();
}
});
}
}
// Clean up problems that have been destroyed
function cleanupProblems() {
for (var i = problems.length - 1; i >= 0; i--) {
if (!problems[i].parent) {
problems.splice(i, 1);
}
}
}
// Spawn tutorial text at start
function showTutorial() {
var tutorialText = new Text2("TAP THE PROBLEMS BEFORE THEY HIT THE GROUND!", {
size: 60,
fill: 0xffffff,
align: 'center',
wordWrap: true,
wordWrapWidth: 1800,
stroke: 0x000000,
strokeThickness: 5
});
tutorialText.anchor.set(0.5, 0.5);
tutorialText.x = 2048 / 2;
tutorialText.y = 2732 / 2;
LK.gui.addChild(tutorialText);
LK.setTimeout(function () {
tween(tutorialText, {
alpha: 0
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
tutorialText.destroy();
}
});
}, 3000);
}
// Show tutorial at start
showTutorial();
// Game update function
game.update = function () {
if (!gameRunning) {
return;
}
// Check if it's time to spawn a new problem
if (LK.ticks * (1000 / 60) - lastProblemTime > problemSpawnTime) {
spawnProblem();
lastProblemTime = LK.ticks * (1000 / 60);
}
// Update all problems
for (var i = 0; i < problems.length; i++) {
problems[i].update();
}
// Check if player should level up
checkLevelProgress();
// Clean up any destroyed problems
cleanupProblems();
// Randomly reduce stress by a small amount (chance for slight recovery)
if (Math.random() < 0.001 && stressLevel !== null && stressLevel !== undefined && stressLevel > 0) {
stressLevel = Math.max(0, stressLevel - 1);
updateStressBar();
}
};
// Add shake effect to entire game when stress is high
LK.setInterval(function () {
if (stressLevel >= 70 && gameRunning) {
var intensity = (stressLevel - 70) / 30; // 0 to 1 based on stress from 70-100
var shake = 10 * intensity;
tween(game, {
x: Math.random() * shake - shake / 2
}, {
duration: 50,
easing: tween.linear,
onFinish: function onFinish() {
tween(game, {
x: 0
}, {
duration: 50,
easing: tween.linear
});
}
});
}
}, 1000);
// Initial stress bar update
updateStressBar();
// Start the music
LK.playMusic('bgmusic');
// Add instructions button
var instructionsButton = new Container();
// Use LK.getAsset instead of Graphics for the button background
var instructionsButtonBg = LK.getAsset('problem', {
anchorX: 0.5,
anchorY: 0.5,
width: 60,
height: 60,
tint: 0x333333,
alpha: 0.7
});
instructionsButtonBg.x = 30;
instructionsButtonBg.y = 30;
instructionsButton.addChild(instructionsButtonBg);
var questionText = new Text2("?", {
size: 40,
fill: 0xffffff
});
questionText.anchor.set(0.5, 0.5);
questionText.x = 30;
questionText.y = 30;
instructionsButton.addChild(questionText);
instructionsButton.x = 50;
instructionsButton.y = 50;
instructionsButton.interactive = true;
LK.gui.addChild(instructionsButton);
instructionsButton.down = function () {
// Show instructions popup
var popup = new Container();
// Darken background using a shape asset instead of Graphics
var bg = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
width: 2048,
height: 2732,
tint: 0x000000,
alpha: 0.7
});
bg.x = 2048 / 2;
bg.y = 2732 / 2;
popup.addChild(bg);
// Instructions panel using a shape asset instead of Graphics
var panel = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
width: 1500,
height: 1000,
tint: 0xffffff,
alpha: 0.9
});
panel.x = 2048 / 2;
panel.y = 2732 / 2;
popup.addChild(panel);
// Title
var title = new Text2("HOW TO PLAY", {
size: 80,
fill: 0xff4d4d,
fontWeight: 'bold'
});
title.anchor.set(0.5, 0);
title.x = panel.x;
title.y = panel.y - 400;
popup.addChild(title);
// Instructions
var instructions = new Text2("1. Tap on the falling problems before they hit the ground\n\n" + "2. Each problem that hits the ground increases your stress\n\n" + "3. Don't let your stress meter reach 100%\n\n" + "4. Score points by tapping problems\n\n" + "5. Level up every 10 points\n\n" + "6. Higher levels = faster problems\n\n" + "7. Just keep telling yourself, \"I'M FINE!\"", {
size: 50,
fill: 0x000000,
align: 'left',
lineHeight: 60
});
instructions.anchor.set(0.5, 0);
instructions.x = panel.x;
instructions.y = panel.y - 300;
popup.addChild(instructions);
// Close button
var closeButton = new Container();
var closeBg = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: 100,
tint: 0xff4d4d
});
closeButton.addChild(closeBg);
var closeText = new Text2("CLOSE", {
size: 50,
fill: 0xffffff
});
closeText.anchor.set(0.5, 0.5);
closeText.x = 0;
closeText.y = 0;
closeButton.addChild(closeText);
closeButton.x = panel.x;
closeButton.y = panel.y + 350;
closeButton.interactive = true;
popup.addChild(closeButton);
closeButton.down = function () {
popup.destroy();
};
LK.gui.addChild(popup);
};
Modern office/workspace with subtle chaotic elements Include desk with scattered papers, coffee stains, overflowing inbox, sticky notes Light, neutral color palette (pale blue/gray) with professional appearance Should look slightly overwhelming but clean enough to not distract from gameplay. In-Game asset. 2d. High contrast. No shadows
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "FOMO Simulator: The Meeting That Could've Been An Email" and with the description "A fast-paced office simulator where you collect meetings, emails, and notifications while managing your energy levels. Strategic decisions must be made about which workplace items to prioritize as your energy depletes. Grab coffee for boosts, avoid missing important meetings, and survive the chaotic 60-second workday!". No text on banner!. In-Game asset. 2d. High contrast. No shadows
Modern App Store icon, high definition, square with rounded corners, for a game titled "FOMO Simulator: The Meeting That Could've Been An Email" and with the description "A fast-paced office simulator where you collect meetings, emails, and notifications while managing your energy levels. Strategic decisions must be made about which workplace items to prioritize as your energy depletes. Grab coffee for boosts, avoid missing important meetings, and survive the chaotic 60-second workday!". No text on icon!. In-Game asset. 2d. High contrast. No shadows