User prompt
80px more to th eright
User prompt
move the level 400px to the right
User prompt
move the level a bit to the left lie 800px
User prompt
move the level at the center.
User prompt
move it 20 more px down
User prompt
move the stress bar 50 px down
User prompt
move the stress level bar to the right 500px
User prompt
The stress bar disappearted.
User prompt
move the stress level bar next to the im fine text with 30 px distance betteen them
User prompt
move the player and the im fine text a bit to the left like 50 px
User prompt
move the I'm fine text under the player
User prompt
Move the player at the bottom left of the screen
User prompt
move the start scree a bit to the left
User prompt
We have clicked the start button. The instructions appear. The game starts after we tap on the screen and the instructions disappear. Not when the instructions are on the screen.
User prompt
That's not working ! The tutorial screen remains there !
User prompt
Fix the stress bar. Add your assets and remove the ones that are there.
User prompt
Adapt this code /**** * Assets ****/ LK.init.shape('problem', {width:200, height:200, color:0xff4d4d, shape:'box'}) LK.init.shape('timer', {width:200, height:20, color:0x00ff00, shape:'box'}) LK.init.image('background', {width:2048, height:2732, id:'681bc32bcd7c937bfead45f7'}) LK.init.image('player', {width:500, height:632, id:'681bc568cd7c937bfead4627'}) LK.init.image('progressBar', {width:600, height:161.72, id:'681c9c69ab6dbd435f68a240'}) LK.init.image('progressFill', {width:500, height:125, id:'681c9ad7ab6dbd435f68a1f5'}) LK.init.music('bgmusic', {volume:0.2, start:0, end:1, id:'681bc6facd7c937bfead4641'}) LK.init.sound('levelup', {volume:1, start:0, end:1, id:'681bc7d0cd7c937bfead4668'}) LK.init.sound('stress', {volume:1, start:0, end:1, id:'681bc7d0cd7c937bfead4668'}) LK.init.sound('tap', {volume:0.8, start:0, end:1, id:'681bc7d0cd7c937bfead4668'}) /**** * 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); // Create player visual var playerGraphic = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5, width: 500, height: 632 }); // Create status text self.statusText = new Text2("I'm fine!", { size: 100, fill: 0x000000, align: 'center', stroke: 0xFFFFFF, strokeThickness: 5 }); self.statusText.anchor.set(0.5, 1.2); self.addChild(self.statusText); // Update appearance based on stress level self.updateAppearance = function (stress) { // Visual changes based on stress if (stress < 30) { // Calm - normal color playerGraphic.tint = 0xFFFFFF; self.statusText.setText("I'm fine!"); self.statusText.style = { fontSize: 100, fill: 0x000000, align: 'center', stroke: 0xFFFFFF, strokeThickness: 5 }; // Reset animations tween.stop(self); tween(self, { rotation: 0, scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeOut }); } else if (stress < 60) { // Getting stressed - slight tint playerGraphic.tint = 0x9b59b6; // Purple tint self.statusText.setText("I'm FINE!"); self.statusText.style = { fontSize: 110, fill: 0x660000, align: 'center', stroke: 0xFFFFFF, strokeThickness: 5 }; // Add slight animation tween.stop(self); tween(self, { scaleX: 1.02, scaleY: 0.98 }, { duration: 1000, easing: tween.easeInOut, onFinish: function() { tween(self, { scaleX: 0.98, scaleY: 1.02 }, { duration: 1000, easing: tween.easeInOut, onFinish: function() { if (stressLevel >= 30 && stressLevel < 60) { self.updateAppearance(stressLevel); } } }); } }); } else if (stress < 90) { // Very stressed - red tint playerGraphic.tint = 0xe74c3c; // Red self.statusText.setText("I'M FINE!!"); self.statusText.style = { fontSize: 120, fill: 0xFF0000, align: 'center', stroke: 0x000000, strokeThickness: 5 }; // Add wobble tween.stop(self); tween(self, { rotation: 0.05, scaleX: 1.05, scaleY: 0.95 }, { duration: 300, easing: tween.easeInOut, onFinish: function() { tween(self, { rotation: -0.05, scaleX: 0.95, scaleY: 1.05 }, { duration: 300, easing: tween.easeInOut, onFinish: function() { if (stressLevel >= 60 && stressLevel < 90) { self.updateAppearance(stressLevel); } } }); } }); } else { // Maximum stress - bright red playerGraphic.tint = 0xff0000; self.statusText.setText("I'M TOTALLY FINE!!!"); self.statusText.style = { fontSize: 130, fill: 0xFF0000, align: 'center', stroke: 0x000000, strokeThickness: 6 }; // Dramatic animation tween.stop(self); tween(self, { rotation: 0.1, scaleX: 1.1, scaleY: 0.9 }, { duration: 200, easing: tween.easeInOut, onFinish: function() { tween(self, { rotation: -0.1, scaleX: 0.9, scaleY: 1.1 }, { duration: 200, easing: tween.easeInOut, onFinish: function() { if (stressLevel >= 90) { self.updateAppearance(stressLevel); } } }); } }); } }; return self; }); var Problem = Container.expand(function () { var self = Container.call(this); // Problem types with text, color, and stress impact var problemTypes = [ { text: "WiFi Down!", color: 0xff4d4d, stress: 8 }, { text: "Coffee Spill!", color: 0x8b4513, stress: 6 }, { text: "Deadline Changed!", color: 0xff9900, stress: 10 }, { text: "Surprise Meeting!", color: 0x9933cc, stress: 12 }, { text: "Traffic Jam!", color: 0x666666, stress: 7 }, { text: "Phone Died!", color: 0x000000, stress: 9 }, { text: "Email Overload!", color: 0x3366ff, stress: 8 }, { text: "Printer Error!", color: 0xcc0000, stress: 7 }, { text: "Noisy Neighbors!", color: 0x99cc00, stress: 6 }, { text: "Low Battery!", color: 0xff6600, stress: 5 } ]; // Choose random problem type var typeIndex = Math.floor(Math.random() * problemTypes.length); var type = problemTypes[typeIndex]; // Problem properties self.active = true; self.stressValue = type.stress; self.maxTime = Math.random() * 3 + 1; // Random time between 1-4 seconds self.timeRemaining = self.maxTime; self.points = Math.ceil(10 / self.maxTime); // Shorter times = more points // Create problem background var problemGraphic = self.attachAsset('problem', { anchorX: 0.5, anchorY: 0.5, tint: type.color }); // Create problem text var problemText = new Text2(type.text, { size: 36, fill: 0xFFFFFF, align: 'center', wordWrap: true, wordWrapWidth: 180 }); problemText.anchor.set(0.5, 0.5); self.addChild(problemText); // Create timer bar self.timerBar = self.attachAsset('timer', { anchorX: 0, anchorY: 0, x: -100, y: 70, width: 200, tint: 0x00ff00 }); // Add timer text self.timerText = new Text2(self.timeRemaining.toFixed(1), { size: 30, fill: 0xFFFFFF, align: 'center' }); self.timerText.anchor.set(0.5, 0.5); self.timerText.x = 0; self.timerText.y = 70; self.addChild(self.timerText); // Handle tap/click self.down = function (x, y, obj) { if (!self.active) return; self.active = false; LK.getSound('tap').play(); // Visual feedback for successful tap tween(self, { alpha: 0, scaleX: 0.2, scaleY: 0.2, rotation: Math.random() * 2 - 1 // Random rotation for variety }, { duration: 300, easing: tween.easeOut, onFinish: function() { self.destroy(); } }); // Award points based on time remaining var pointsAwarded = Math.ceil(self.points * (self.timeRemaining / self.maxTime)); score += pointsAwarded; scoreText.setText("SCORE: " + score); // Show points popup var pointsPopup = new Text2("+" + pointsAwarded, { size: 50, fill: 0x00ff00, stroke: 0x000000, strokeThickness: 4 }); pointsPopup.anchor.set(0.5, 0.5); pointsPopup.x = self.x; pointsPopup.y = self.y; game.addChild(pointsPopup); // Animate points popup tween(pointsPopup, { y: pointsPopup.y - 100, alpha: 0 }, { duration: 800, easing: tween.easeOut, onFinish: function() { pointsPopup.destroy(); } }); }; // Update timer self.update = function(delta) { if (!self.active) return; // Decrease timer self.timeRemaining -= delta; // Update timer bar width var timerPercent = Math.max(0, self.timeRemaining / self.maxTime); self.timerBar.width = 200 * timerPercent; // Change timer color as time runs out if (timerPercent > 0.6) { self.timerBar.tint = 0x00ff00; // Green } else if (timerPercent > 0.3) { self.timerBar.tint = 0xffff00; // Yellow } else { self.timerBar.tint = 0xff0000; // Red } // Update timer text self.timerText.setText(Math.max(0, self.timeRemaining).toFixed(1)); // Check if timer expired if (self.timeRemaining <= 0) { self.active = false; // Visual feedback for expired timer LK.getSound('stress').play(); // Increase stress stressLevel += self.stressValue; updateStressBar(); // Flash screen red LK.effects.flashScreen(0xff0000, 200, 0.3); // Shrink and fade out tween(self, { alpha: 0, scaleX: 0.2, scaleY: 0.2 }, { duration: 300, easing: tween.easeOut, onFinish: function() { self.destroy(); } }); // Show stress increase popup var stressPopup = new Text2("+" + self.stressValue + " STRESS!", { size: 40, fill: 0xff0000, stroke: 0x000000, strokeThickness: 4 }); stressPopup.anchor.set(0.5, 0.5); stressPopup.x = self.x; stressPopup.y = self.y; game.addChild(stressPopup); // Animate stress popup tween(stressPopup, { y: stressPopup.y - 100, alpha: 0 }, { duration: 800, easing: tween.easeOut, onFinish: function() { stressPopup.destroy(); } }); } }; // Spawn animation self.scale.set(0); tween(self, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.elasticOut }); return self; }); var StressBar = Container.expand(function () { var self = Container.call(this); // Create stress bar elements var background = self.attachAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, width: 1000, height: 80 }); var fill = self.attachAsset('progressFill', { anchorX: 0, anchorY: 0.5, x: -background.width / 2, y: 0, width: 0 // Start with 0 width }); // Add stress label var label = new Text2("STRESS LEVEL", { size: 40, fill: 0xFFFFFF, fontWeight: 'bold', stroke: 0x000000, strokeThickness: 4 }); label.anchor.set(0.5, 0.5); label.x = 0; label.y = 0; self.addChild(label); // Update fill based on stress level self.updateFill = function (stressLevel) { var maxWidth = background.width; var newWidth = (stressLevel / 100) * maxWidth; // Tween the fill bar tween(fill, { width: newWidth }, { duration: 300, easing: tween.easeOut }); // Change fill color based on stress level if (stressLevel < 30) { fill.tint = 0x00ff00; // Green } else if (stressLevel < 60) { fill.tint = 0xffff00; // Yellow } else if (stressLevel < 90) { fill.tint = 0xff9900; // Orange } else { fill.tint = 0xff0000; // Red } }; return self; }); // Code for creating scrolling code in the background var CodeLine = Container.expand(function (length, yPos) { var self = Container.call(this); // Random line properties var colors = [0x00ff00, 0x3498db, 0xff9900, 0x9b59b6, 0xf1c40f]; var randomColor = colors[Math.floor(Math.random() * colors.length)]; // Create line var line = self.attachAsset('timer', { anchorX: 0, anchorY: 0.5, width: length || Math.random() * 500 + 100, height: 10, tint: randomColor }); self.y = yPos || 0; return self; }); var CodeBackground = Container.expand(function () { var self = Container.call(this); var lines = []; var lineSpacing = 40; // Initialize with random code lines self.initialize = function () { for (var i = 0; i < 100; i++) { var line = new CodeLine( Math.random() * 1000 + 100, i * lineSpacing ); line.x = Math.random() * (2048 - line.width); self.addChild(line); lines.push(line); } }; // Move lines upward self.update = function () { for (var i = 0; i < lines.length; i++) { lines[i].y -= 1; // If line moved off screen, reset to bottom if (lines[i].y < -20) { lines[i].y = 2732 + Math.random() * 100; lines[i].x = Math.random() * (2048 - lines[i].width); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x192a56 // Dark blue background }); /**** * Game Code ****/ // Game state variables var score = 0; var stressLevel = 0; var gameLevel = 1; var problems = []; var lastProblemTime = 0; var problemSpawnInterval = 1800; // ms between problem spawns var maxProblemsOnScreen = 4; // Maximum problems on screen at once var gameRunning = true; var gameStarted = false; var lastUpdate = Date.now(); // Set up code background var codeBackground = new CodeBackground(); codeBackground.initialize(); codeBackground.alpha = 0.2; game.addChild(codeBackground); // Set up regular background var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, alpha: 0.8 // Semi-transparent to show code background }); game.addChild(background); // Set up player var player = new Player(); player.x = 2048 / 2; player.y = 2732 - 500; game.addChild(player); // Set up score text var scoreText = new Text2("SCORE: 0", { size: 70, fill: 0xFFFFFF, stroke: 0x000000, strokeThickness: 5 }); scoreText.anchor.set(0.5, 0); scoreText.x = 2048 / 2; scoreText.y = 20; LK.gui.top.addChild(scoreText); // Set up level text var levelText = new Text2("LEVEL: 1", { size: 50, fill: 0xFFFFFF, stroke: 0x000000, strokeThickness: 3 }); levelText.anchor.set(0, 0); levelText.x = 50; levelText.y = 30; LK.gui.addChild(levelText); // Game title var titleText = new Text2("I'M FINE!", { size: 200, fill: 0xff4d4d, fontWeight: 'bold', stroke: 0xFFFFFF, strokeThickness: 10 }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 500; LK.gui.addChild(titleText); // Game subtitle var subtitleText = new Text2("(a game about pretending everything is OK)", { size: 60, fill: 0xFFFFFF, fontStyle: 'italic' }); subtitleText.anchor.set(0.5, 0.5); subtitleText.x = 2048 / 2; subtitleText.y = 600; LK.gui.addChild(subtitleText); // Create start button var startButton = new Container(); startButton.interactive = true; var startBg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 500, height: 120, tint: 0xff4d4d }); startButton.addChild(startBg); var startText = new Text2("START GAME", { size: 70, fill: 0xFFFFFF, fontWeight: 'bold' }); startText.anchor.set(0.5, 0.5); startText.x = 0; startText.y = 0; startButton.addChild(startText); startButton.x = 2048 / 2; startButton.y = 2732 / 2; LK.gui.addChild(startButton); // Create and position stress bar var stressBar = new StressBar(); stressBar.x = 2048 / 2; stressBar.y = 120; stressBar.alpha = 0; // Hidden until game starts LK.gui.addChild(stressBar); // Instructions button var instructionsButton = new Container(); instructionsButton.interactive = true; var instructionsBg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 80, height: 80, tint: 0x333333, alpha: 0.9 }); instructionsButton.addChild(instructionsBg); var questionText = new Text2("?", { size: 60, fill: 0xFFFFFF, fontWeight: 'bold' }); questionText.anchor.set(0.5, 0.5); questionText.x = 0; questionText.y = 0; instructionsButton.addChild(questionText); instructionsButton.x = 100; instructionsButton.y = 100; instructionsButton.alpha = 0; // Hidden until game starts LK.gui.addChild(instructionsButton); // Update stress bar function updateStressBar() { // Clamp stress level between 0-100 stressLevel = Math.min(100, Math.max(0, stressLevel)); // Update stress bar fill stressBar.updateFill(stressLevel); // Update player appearance player.updateAppearance(stressLevel); // Check for game over if (stressLevel >= 100 && gameRunning) { gameOver(); } } // Spawn a new problem function spawnProblem() { if (!gameRunning || !gameStarted) return; // Don't spawn if we already have max problems if (problems.length >= maxProblemsOnScreen) return; // Create new problem var problem = new Problem(); // Position randomly, but keep away from edges problem.x = Math.random() * (2048 - 400) + 200; problem.y = Math.random() * (2732 - 800) + 400; // Make sure it doesn't overlap with player var distToPlayer = Math.sqrt( Math.pow(problem.x - player.x, 2) + Math.pow(problem.y - player.y, 2) ); if (distToPlayer < 500) { // Too close to player, adjust position var angle = Math.random() * Math.PI * 2; problem.x = player.x + Math.cos(angle) * 600; problem.y = player.y + Math.sin(angle) * 600; // Keep within screen bounds problem.x = Math.max(200, Math.min(problem.x, 2048 - 200)); problem.y = Math.max(400, Math.min(problem.y, 2732 - 400)); } game.addChild(problem); problems.push(problem); } // Start game function function startGame() { gameStarted = true; gameRunning = true; // Hide start screen elements tween(titleText, { y: -200, alpha: 0 }, { duration: 500, easing: tween.easeIn }); tween(subtitleText, { y: -200, alpha: 0 }, { duration: 500, easing: tween.easeIn }); tween(startButton, { y: 2732 + 200, alpha: 0 }, { duration: 500, easing: tween.easeIn, onFinish: function() { // Show game UI tween(stressBar, { alpha: 1 }, { duration: 500 }); tween(instructionsButton, { alpha: 1 }, { duration: 500 }); // Show tutorial showTutorial(); // Start music LK.playMusic('bgmusic'); } }); } // Show tutorial function showTutorial() { var tutorialContainer = new Container(); // Darken background var tutorialBg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, tint: 0x000000, alpha: 0.7 }); tutorialContainer.addChild(tutorialBg); // Title var tutorialTitle = new Text2("HOW TO PLAY", { size: 100, fill: 0xFFFFFF, fontWeight: 'bold' }); tutorialTitle.anchor.set(0.5, 0.5); tutorialTitle.x = 2048 / 2; tutorialTitle.y = 500; tutorialContainer.addChild(tutorialTitle); // Instructions var instructions = new Text2( "• PROBLEMS will appear randomly on screen\n\n" + "• Each problem has a COUNTDOWN TIMER\n\n" + "• TAP problems before their timer runs out\n\n" + "• If time runs out, your STRESS increases\n\n" + "• Don't let your stress reach 100%\n\n" + "• Just keep telling yourself \"I'M FINE!\"", { size: 60, fill: 0xFFFFFF, align: 'center', lineHeight: 80 } ); instructions.anchor.set(0.5, 0.5); instructions.x = 2048 / 2; instructions.y = 1000; tutorialContainer.addChild(instructions); // Example problem var exampleProblem = new Problem(); exampleProblem.x = 2048 / 2; exampleProblem.y = 1500; tutorialContainer.addChild(exampleProblem); // Continue button var continueButton = new Container(); continueButton.interactive = true; var continueBg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120, tint: 0x00cc00 }); continueButton.addChild(continueBg); var continueText = new Text2("START!", { size: 70, fill: 0xFFFFFF, fontWeight: 'bold' }); continueText.anchor.set(0.5, 0.5); continueText.x = 0; continueText.y = 0; continueButton.addChild(continueText); continueButton.x = 2048 / 2; continueButton.y = 2000; tutorialContainer.addChild(continueButton); // Add to GUI LK.gui.addChild(tutorialContainer); // Handle button click continueButton.down = function() { tutorialContainer.destroy(); }; } // Instructions popup function showInstructions() { var popup = new Container(); // Darken background var bg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, tint: 0x000000, alpha: 0.7 }); popup.addChild(bg); // Panel background var panel = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 1600, height: 1800, 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: 100, fill: 0xff4d4d, fontWeight: 'bold', stroke: 0x000000, strokeThickness: 5 }); title.anchor.set(0.5, 0); title.x = 2048 / 2; title.y = panel.y - 800; popup.addChild(title); // Instructions var instructions = new Text2( "1. PROBLEMS will appear randomly on screen\n\n" + "2. Each problem has a COUNTDOWN TIMER\n\n" + "3. TAP problems before their timer runs out\n\n" + "4. If time runs out, your STRESS increases\n\n" + "5. Don't let your stress reach 100%\n\n" + "6. LEVEL UP every 10 points\n\n" + "7. Just keep telling yourself \"I'M FINE!\"", { size: 50, fill: 0x000000, align: 'left', lineHeight: 70, wordWrap: true, wordWrapWidth: panel.width - 200 } ); instructions.anchor.set(0, 0); instructions.x = panel.x - 700; instructions.y = panel.y - 600; popup.addChild(instructions); // Close button var closeButton = new Container(); closeButton.interactive = true; var closeBg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120, tint: 0xff4d4d }); closeButton.addChild(closeBg); var closeText = new Text2("RESUME", { size: 60, fill: 0xFFFFFF, fontWeight: 'bold' }); closeText.anchor.set(0.5, 0.5); closeText.x = 0; closeText.y = 0; closeButton.addChild(closeText); closeButton.x = panel.x; closeButton.y = panel.y + 700; popup.addChild(closeButton); // Pause game while instructions are open var wasPaused = !gameRunning; gameRunning = false; closeButton.down = function() { popup.destroy(); if (!wasPaused) { gameRunning = true; } }; LK.gui.addChild(popup); } // Check if level should increase function checkLevelProgress() { var newLevel = Math.floor(score / 10) + 1; if (newLevel > gameLevel) { gameLevel = newLevel; levelText.setText("LEVEL: " + gameLevel); // Make game harder as level increases problemSpawnInterval = Math.max(500, 1800 - (gameLevel * 100)); maxProblemsOnScreen = Math.min(8, 4 + Math.floor(gameLevel / 2)); // Visual and audio feedback LK.effects.flashScreen(0x00ff00, 500, 0.3); LK.getSound('levelup').play(); // Show level up text var levelUpText = new Text2("LEVEL UP!", { size: 100, fill: 0x00ff00, stroke: 0x000000, strokeThickness: 6 }); levelUpText.anchor.set(0.5, 0.5); levelUpText.x = 2048 / 2; levelUpText.y = 2732 / 2; LK.gui.addChild(levelUpText); // Animate and remove tween(levelUpText, { scaleX: 2, scaleY: 2, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function() { levelUpText.destroy(); } }); } } // Game over function function gameOver() { gameRunning = false; // Visual effects LK.effects.flashScreen(0xff0000, 1000); // Game over container var gameOverContainer = new Container(); // Darken background var darkOverlay = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, tint: 0x000000, alpha: 0.8 }); darkOverlay.x = 2048 / 2; darkOverlay.y = 2732 / 2; gameOverContainer.addChild(darkOverlay); // Game over text var gameOverText = new Text2("YOU'RE NOT FINE!", { size: 120, fill: 0xff0000, fontWeight: 'bold', stroke: 0xFFFFFF, strokeThickness: 8 }); gameOverText.anchor.set(0.5, 0.5); gameOverText.x = 2048 / 2; gameOverText.y = 700; gameOverContainer.addChild(gameOverText); // Meme text var memeText = new Text2("(But we've all been there...)", { size: 70, fill: 0xFFFFFF, fontStyle: 'italic' }); memeText.anchor.set(0.5, 0.5); memeText.x = 2048 / 2; memeText.y = 850; gameOverContainer.addChild(memeText); // Final score var finalScoreText = new Text2("FINAL SCORE: " + score, { size: 100, fill: 0xffff00, stroke: 0x000000, strokeThickness: 5 }); finalScoreText.anchor.set(0.5, 0.5); finalScoreText.x = 2048 / 2; finalScoreText.y = 1100; gameOverContainer.addChild(finalScoreText); // Level reached var levelReachedText = new Text2("LEVEL REACHED: " + gameLevel, { size: 80, fill: 0xFFFFFF }); levelReachedText.anchor.set(0.5, 0.5); levelReachedText.x = 2048 / 2; levelReachedText.y = 1250; gameOverContainer.addChild(levelReachedText); // Restart button var restartButton = new Container(); restartButton.interactive = true; var restartBg = LK.getAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 500, height: 120, tint: 0x00cc00 }); restartButton.addChild(restartBg); var restartText = new Text2("PLAY AGAIN", { size: 70, fill: 0xFFFFFF, fontWeight: 'bold' }); restartText.anchor.set(0.5, 0.5); restartText.x = 0; restartText.y = 0; restartButton.addChild(restartText); restartButton.x = 2048 / 2; restartButton.y = 1500; gameOverContainer.addChild(restartButton); // Add fun meme image or message var memeQuote = new Text2(getRandomMemeQuote(), { size: 60, fill: 0xFFFFFF, fontStyle: 'italic', align: 'center', wordWrap: true, wordWrapWidth: 1600 }); memeQuote.anchor.set(0.5, 0.5); memeQuote.x = 2048 / 2; memeQuote.y = 1800; gameOverContainer.addChild(memeQuote); // Animate in gameOverText.alpha = 0; gameOverText.y -= 100; memeText.alpha = 0; finalScoreText.alpha = 0; levelReachedText.alpha = 0; restartButton.alpha = 0; memeQuote.alpha = 0; tween(gameOverText, { alpha: 1, y: gameOverText.y + 100 }, { duration: 500, easing: tween.elasticOut }); tween(memeText, { alpha: 1 }, { duration: 500, delay: 500 }); tween(finalScoreText, { alpha: 1 }, { duration: 500, delay: 1000 }); tween(levelReachedText, { alpha: 1 }, { duration: 500, delay: 1500 }); tween(restartButton, { alpha: 1 }, { duration: 500, delay: 2000 }); tween(memeQuote, { alpha: 1 }, { duration: 500, delay: 2500 }); // Handle restart restartButton.down = function() { restartGame(); gameOverContainer.destroy(); }; LK.gui.addChild(gameOverContainer); } // Restart game function restartGame() { // Reset game variables score = 0; stressLevel = 0; gameLevel = 1; problemSpawnInterval = 1800; maxProblemsOnScreen = 4; lastProblemTime = 0; gameRunning = true; // Clear any existing problems for (var i = 0; i < problems.length; i++) { if (problems[i].parent) { problems[i].destroy(); } } problems = []; // Reset UI scoreText.setText("SCORE: 0"); levelText.setText("LEVEL: 1"); updateStressBar(); // Reset player player.updateAppearance(0); // Restart music LK.playMusic('bgmusic'); // Show tutorial again showTutorial(); } // Get random meme quote for game over screen function getRandomMemeQuote() { var quotes = [ "This is fine. Everything is fine.", "When someone asks how you're doing and you say 'fine' for the 47th time today.", "Me pretending my life isn't falling apart.", "Monday: I'm fine. Tuesday: I'M FINE! Friday: EVERYTHING IS FINE!!!", "When the deadline is tomorrow and you haven't started yet: I'M FINE!", "Adult life is saying 'I'm fine' when people ask how you are until you actually are.", "No one: \nMe: I'M FINE!!! EVERYTHING IS FINE!!!", "When your coffee spills, WiFi drops, and deadline changes all at once: I'M TOTALLY FINE!" ]; return quotes[Math.floor(Math.random() * quotes.length)]; } // Screen shake effect function shakeScreen(intensity) { if (!gameRunning) return; tween(game, { x: Math.random() * intensity - intensity/2 }, { duration: 50, easing: tween.linear, onFinish: function() { tween(game, { x: Math.random() * intensity - intensity/2 }, { duration: 50, easing: tween.linear, onFinish: function() { tween(game, { x: 0 }, { duration: 50, easing: tween.linear }); } }); } }); } // Clean up problems array function cleanupProblems() { for (var i = problems.length - 1; i >= 0; i--) { if (!problems[i].parent) { problems.splice(i, 1); } } } // Handle instructions button instructionsButton.down = function() { if (gameStarted) { showInstructions(); } }; // Handle start button startButton.down = function() { startGame(); }; // Main game update function game.update = function() { // Calculate delta time for consistent updates var now = Date.now(); var delta = (now - lastUpdate) / 1000; // Convert to seconds lastUpdate = now; // Update code background for visual effect codeBackground.update(); if (!gameRunning || !gameStarted) return; // Check if it's time to spawn a new problem if (now - lastProblemTime > problemSpawnInterval) { spawnProblem(); lastProblemTime = now; } // Update all problems for (var i = 0; i < problems.length; i++) { if (problems[i] && problems[i].update) { problems[i].update(delta); } } // Clean up problems array cleanupProblems(); // Check level progress checkLevelProgress(); // Randomly reduce stress (small recovery chance) if (Math.random() < 0.001 * delta * 60 && stressLevel > 0) { stressLevel = Math.max(0, stressLevel - 0.5); updateStressBar(); } // Add screen shake when stress is high if (stressLevel >= 70 && Math.random() < 0.05) { var intensity = (stressLevel - 70) / 30 * 20; shakeScreen(intensity); } }; // Start the music (lower volume) LK.playMusic('bgmusic'); ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (4 edits merged)
Please save this source code
User prompt
Remove the code lines.
User prompt
Remove the clock
User prompt
The stress level text should be inside the stress level bar. White bold color.
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
so currently is at the top right and part of it is outside the screen. Move it to be bottom middle under the player asset.
User prompt
Move stress bar to the top middle
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Clock = Container.expand(function () { var self = Container.call(this); // Create clock face var clockFace = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 400, tint: 0xFFFFFF //alpha: 0 // Make it transparent }); // Make sure clock face is circular by setting borderRadius clockFace.shape = 'ellipse'; self.addChild(clockFace); // Create four indicators like in a typical clock at 12, 3, 6, and 9 positions // 12 o'clock indicator var indicator12 = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, width: 20, height: 40, tint: 0x000000 }); indicator12.x = 0; indicator12.y = -150; // Top self.addChild(indicator12); // 3 o'clock indicator var indicator3 = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, width: 40, height: 20, tint: 0x000000 }); indicator3.x = 150; // Right indicator3.y = 0; self.addChild(indicator3); // 6 o'clock indicator var indicator6 = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, width: 20, height: 40, tint: 0x000000 }); indicator6.x = 0; indicator6.y = 150; // Bottom self.addChild(indicator6); // 9 o'clock indicator var indicator9 = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, width: 40, height: 20, tint: 0x000000 }); indicator9.x = -150; // Left indicator9.y = 0; self.addChild(indicator9); // Create hour hand var hourHand = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0, width: 15, height: 120, tint: 0x000000 }); self.addChild(hourHand); // Create minute hand var minuteHand = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0, width: 8, height: 180, tint: 0x555555 }); self.addChild(minuteHand); // Clock center dot var centerDot = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, width: 20, height: 20, tint: 0x000000, shape: 'ellipse' }); self.addChild(centerDot); // Add interactive capabilities for dragging self.interactive = true; var isDragging = false; var dragOffsetX = 0; var dragOffsetY = 0; // Event handler for when pressed down on the clock self.down = function (x, y, obj) { isDragging = true; // Calculate offset between touch point and clock center var globalPos = obj.parent.toGlobal(obj.position); var localPos = game.toLocal(globalPos); dragOffsetX = x - localPos.x; dragOffsetY = y - localPos.y; // Play sound feedback when starting to drag LK.getSound('tap').play(); }; // Event handler for when released self.up = function () { isDragging = false; }; // Event handler for movement self.move = function (x, y, obj) { if (isDragging) { self.x = x - dragOffsetX; self.y = y - dragOffsetY; // Make sure clock stays within the screen bounds self.x = Math.max(200, Math.min(self.x, 2048 - 200)); self.y = Math.max(200, Math.min(self.y, 2732 - 200)); } }; // Initialize hands self.updateClock = function () { // Make the clock hands move rapidly by using LK.ticks var ticks = LK.ticks; // Hour hand completes full rotation every 1 second (60 frames) var hourAngle = ticks % 60 / 60 * 2 * Math.PI; hourHand.rotation = hourAngle; // Minute hand rotates even faster (complete rotation in 0.25 seconds) var minuteAngle = ticks % 15 / 15 * 2 * Math.PI; minuteHand.rotation = minuteAngle; }; // Initial update self.updateClock(); return self; }); var CodeWindow = Container.expand(function () { var self = Container.call(this); // Create window background var windowBg = self.attachAsset('problem', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 600, tint: 0x333333, alpha: 0.9 }); // Container for colored lines var linesContainer = new Container(); linesContainer.x = 0; linesContainer.y = 0; self.addChild(linesContainer); // Store lines var coloredLines = []; var lineHeight = 20; var lineSpacing = 5; var windowWidth = 380; // Add a new colored line self.addLine = function () { var line = new ColoredLine(); line.x = -windowWidth / 2; line.y = coloredLines.length * (lineHeight + lineSpacing); // Set random line width line.setRandomLength(windowWidth); linesContainer.addChild(line); coloredLines.push(line); // Make sure lines are contained within window self.adjustLines(); return line; }; // Move all lines up self.moveLines = function () { // Move existing lines up for (var i = 0; i < coloredLines.length; i++) { var line = coloredLines[i]; line.y -= lineHeight + lineSpacing; } // Remove lines that moved out of view while (coloredLines.length > 0 && coloredLines[0].y < -lineHeight) { var oldLine = coloredLines.shift(); oldLine.destroy(); } // Add a new line at the bottom self.addLine(); }; // Adjust lines to fit in window self.adjustLines = function () { // Center lines container linesContainer.x = 0; linesContainer.y = -windowBg.height / 2 + windowBg.height - 100; // Position near bottom }; // Initialize with a few lines self.initialize = function () { for (var i = 0; i < 8; i++) { self.addLine(); } self.adjustLines(); }; return self; }); var ColoredLine = Container.expand(function () { var self = Container.call(this); // Create a colored line using progressBar asset var lineGraphic = self.attachAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, height: 20 // Thin line }); // Set random color for the line self.setRandomColor = function () { // Array of bright colors var colors = [0xFF0000, // Red 0x00FF00, // Green 0x0000FF, // Blue 0xFFFF00, // Yellow 0xFF00FF, // Magenta 0x00FFFF, // Cyan 0xFF6600, // Orange 0x9900FF // Purple ]; // Pick a random color var randomColor = colors[Math.floor(Math.random() * colors.length)]; lineGraphic.tint = randomColor; }; // Set random length for the line self.setRandomLength = function (maxWidth) { // Generate a random length between 30% and 100% of maxWidth var randomLength = Math.random() * 0.7 * maxWidth + 0.3 * maxWidth; lineGraphic.width = randomLength; }; // Initialize with random color self.setRandomColor(); return self; }); var LineManager = Container.expand(function () { var self = Container.call(this); // Store all active lines var lines = []; var windowWidth = 2048; var lineHeight = 20; var lineSpacing = 30; // Space between lines var moveSpeed = 2; // Speed lines move upward // Initialize with some starting lines at the bottom self.initialize = function () { // Start with 5 lines at the bottom var startY = 2732 - lineHeight; for (var i = 0; i < 5; i++) { self.addNewLine(startY - i * lineSpacing); } }; // Add a new line at the bottom self.addNewLine = function (yPosition) { var line = new ColoredLine(); line.x = windowWidth / 2; line.y = yPosition || 2732 - lineHeight / 2; line.width = windowWidth; self.addChild(line); lines.push(line); return line; }; // Update method - move lines upward and add new ones as needed self.update = function () { // Move all existing lines upward for (var i = lines.length - 1; i >= 0; i--) { var line = lines[i]; line.y -= moveSpeed; // Remove lines that are offscreen if (line.y < -lineHeight) { line.destroy(); lines.splice(i, 1); } } // Check if we need to add a new line at the bottom var lastLine = lines[lines.length - 1]; if (lastLine && lastLine.y < 2732 - lineSpacing) { self.addNewLine(); } }; return self; }); 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: 200, fill: 0x000000, lineHeight: 60, stroke: 0x000000, strokeThickness: 5 }); // Initialize the style object properly self.statusText.style = { fill: 0x000000, fontSize: 40 }; self.statusText.anchor.set(0.5); // Position relative to self, not self.player which doesn't exist self.statusText.x = 0; // Center relative to player self.statusText.y = -2000; // 50px above player 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, fontSize: 200 }, { text: "Coffee Spill!", color: 0x8b4513 }, { text: "Deadline Changed!", color: 0xff9900 }, { text: "Surprise Meeting!", color: 0x9933cc }, { text: "Traffic Jam!", color: 0x666666, fontSize: 200 }, { text: "Phone Died!", color: 0x000000, fontSize: 200 }, { text: "Email Overload!", color: 0x3366ff, fontSize: 200 }, { text: "Printer Error!", color: 0xcc0000, fontSize: 200 }, { text: "Noisy Neighbors!", color: 0x99cc00, fontSize: 200 }, { text: "Low Battery!", color: 0xff6600, fontSize: 200 }]; // 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: 48, 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; }); var StressBar = Container.expand(function () { var self = Container.call(this); // Create elements var background = self.attachAsset('progressBar', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0 }); var fill = self.attachAsset('progressFill', { anchorX: 0, anchorY: 0.5, x: -background.width / 2, y: 0, width: 0 // Start with 0 width }); var label = new Text2("STRESS LEVEL", { size: 30, fill: 0xFFFFFF, fontWeight: 'bold' }); label.anchor.set(0.5, 0.5); label.x = 0; label.y = 0; self.addChild(label); // Interactive capabilities for dragging self.interactive = true; var isDragging = false; var dragOffsetX = 0; var dragOffsetY = 0; // Event handler for down self.down = function (x, y, obj) { isDragging = true; // Calculate offset between touch point and stress bar center var globalPos = obj.parent.toGlobal(obj.position); var localPos = game.toLocal(globalPos); dragOffsetX = x - localPos.x; dragOffsetY = y - localPos.y; // Play sound feedback LK.getSound('tap').play(); }; // Event handler for up self.up = function () { isDragging = false; }; // Event handler for move self.move = function (x, y, obj) { if (isDragging) { self.x = x - dragOffsetX; self.y = y - dragOffsetY; // Make sure the bar stays within the screen bounds self.x = Math.max(500, Math.min(self.x, 2048 - 500)); self.y = Math.max(100, Math.min(self.y, 2732 - 100)); } }; // Update fill based on stress level self.updateFill = function (stressLevel) { var maxWidth = 1000; var newWidth = stressLevel / 100 * maxWidth; // Tween the progress bar fill tween(fill, { width: newWidth }, { duration: 300, easing: tween.easeOut }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xe8f4f8 // Light blue background }); /**** * Game Code ****/ // Replace with actual ID // Replace with actual ID // Replace with actual ID // Replace with actual ID // Replace with actual ID // Replace with actual ID // Game state variables 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 = 30; 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); // Create and initialize stress bar container var stressBar = new StressBar(); stressBar.x = 1500 / 2; // Position at top middle of screen stressBar.y = 1850; LK.gui.addChild(stressBar); // Assign to global variables for compatibility with existing code progressBarBackground = stressBar.children[0]; progressBarFill = stressBar.children[1]; // Update stress bar based on current stress level function updateStressBar() { // Use the StressBar updateFill method to update the stress bar stressBar.updateFill(stressLevel); // 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 = 1048 / 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(); // No need to update the code window here as it's controlled by the interval // Randomly reduce stress by a small amount (chance for slight recovery) if (Math.random() < 0.001 && 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(); // Add clock to background var clock = new Clock(); clock.x = 1750; // Position in top right area clock.y = 250; clock.scale.set(0.8); // Size the clock appropriately game.addChild(clock); // Animate clock hands LK.setInterval(function () { if (clock && gameRunning) { clock.updateClock(); } }, 10); // Update more frequently for extra rapid movement // Create code window with colored lines at the bottom var codeWindow = new CodeWindow(); codeWindow.x = 1500; codeWindow.y = 1200; codeWindow.initialize(); game.addChild(codeWindow); // Set interval to add new colored lines LK.setInterval(function () { if (gameRunning) { codeWindow.moveLines(); } }, 500); // 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: 'center', lineHeight: 60, wordWrap: true, wordWrapWidth: panel.width * 0.9 // Wrap to 90% of panel width }); // Anchor and position at top center instructions.anchor.set(0.5, 0); instructions.x = panel.x + panel.width / 2; // Center horizontally instructions.y = 20; // Near top of screen 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); };
===================================================================
--- original.js
+++ change.js
@@ -534,13 +534,14 @@
width: 0 // Start with 0 width
});
var label = new Text2("STRESS LEVEL", {
size: 30,
- fill: 0x000000
+ fill: 0xFFFFFF,
+ fontWeight: 'bold'
});
- label.anchor.set(0.5, 1);
+ label.anchor.set(0.5, 0.5);
label.x = 0;
- label.y = -35;
+ label.y = 0;
self.addChild(label);
// Interactive capabilities for dragging
self.interactive = true;
var isDragging = false;
@@ -595,15 +596,15 @@
/****
* 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
+// Game state variables
var score = 0;
var stressLevel = 0;
var gameLevel = 1;
var problems = [];
@@ -658,9 +659,9 @@
LK.gui.addChild(titleText);
// Create and initialize stress bar container
var stressBar = new StressBar();
stressBar.x = 1500 / 2; // Position at top middle of screen
-stressBar.y = 1900;
+stressBar.y = 1850;
LK.gui.addChild(stressBar);
// Assign to global variables for compatibility with existing code
progressBarBackground = stressBar.children[0];
progressBarFill = stressBar.children[1];
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