User prompt
Redo the score calculation for the ball and coffee bean for gamemodes other than normal.
User prompt
Make it so you can only click a difficulty button once per second
User prompt
Fix potential bugs
User prompt
Fix potential bugs with the difficulty buttons and color changing.
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'game.addChildAt(object, game.getChildIndex(settingsButton) - 1);' Line Number: 785
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'game.addChildAt(object, game.getChildIndex(settingsButton) - 1);' Line Number: 786
User prompt
Fix Bug: 'ReferenceError: gameSettings is not defined' in this line: 'var speedMultiplier = gameSettings.difficulty === 'hard' ? 4 : gameSettings.difficulty === 'insane' ? 10 : gameSettings.difficulty === 'easy' ? 1 : 2;' Line Number: 572
User prompt
Fix Bug: 'ReferenceError: gameSettings is not defined' in this line: 'var speedMultiplier = gameSettings.difficulty === 'hard' ? 4 : gameSettings.difficulty === 'insane' ? 10 : gameSettings.difficulty === 'easy' ? 1 : 2;' Line Number: 572
User prompt
Fix Bug: 'ReferenceError: cup is not defined' in this line: 'if (cup.intersects(balls[i])) {' Line Number: 803
User prompt
Fix Bug: 'ReferenceError: cup is not defined' in this line: 'if (cup.intersects(balls[i])) {' Line Number: 802
User prompt
Fix Bug: 'ReferenceError: settingsButton is not defined' in this line: 'game.addChildAt(object, game.getChildIndex(settingsButton) - 1);' Line Number: 779
User prompt
Forward development of the game without breaking anything.
User prompt
Change the values of the items in the "easy" difficulty. Timer = +20 seconds on 60 second countdown, +0 score; ball asset = +1 second on 60 second countdown, +1 score; coffeebean = +1 second on 60 second countdown, +5 score
User prompt
Fix Bug: 'Uncaught ReferenceError: Cup is not defined' in this line: 'var cup = game.addChild(new Cup());' Line Number: 744
User prompt
Forward the development of the game without breaking it.
User prompt
Add a 1.05 zoom in animation when a difficulty button in the settings gui is clicked.
User prompt
Forward the development of the game without breaking it.
User prompt
Fix Bug: 'ReferenceError: addTimerItem is not defined' in this line: 'addTimerItem();' Line Number: 768
User prompt
Fix Bug: 'ReferenceError: addCoffeeBean is not defined' in this line: 'addCoffeeBean();' Line Number: 766
User prompt
Fix Bug: 'ReferenceError: addBall is not defined' in this line: 'addBall();' Line Number: 770
User prompt
Forward development of the game without breaking anything.
User prompt
Forward development of the game without breaking anything.
User prompt
Forward development of the game without breaking anything.
User prompt
Organize the pause feature code while keeping all functions of pause.
User prompt
Make the particles of items children of the item
/**** * Classes ****/ var RotateAndZoomAnimation = Container.expand(function (target, zoomFactor, animationFrames, rotations) { var self = Container.call(this); self.target = target; self.zoomFactor = zoomFactor; self.animationFrames = animationFrames; self.rotations = rotations; self.currentFrame = 0; self.updateAnimation = function () { if (self.currentFrame < self.animationFrames) { var progress = self.currentFrame / self.animationFrames; self.target.scale.x = self.target.scale.x * (1 + self.zoomFactor * progress); self.target.scale.y = self.target.scale.y * (1 + self.zoomFactor * progress); self.target.rotation = 2 * Math.PI * self.rotations * progress; self.currentFrame++; } else { LK.off('tick', self.updateAnimation); if (self.onComplete) { self.onComplete(); } } }; self.start = function (onComplete) { self.onComplete = onComplete; LK.on('tick', self.updateAnimation); }; }); var Countdown = Container.expand(function () { var self = Container.call(this); self.counter = 3; var countdownText = new Text2(self.counter.toString(), { size: 200, fill: '#00ff00', // Green color anchor: { x: 0.5, y: 0.5 } }); self.addChild(countdownText); countdownText.x = 2048 / 2; countdownText.y = 2732 / 2; self.update = function () { if (self.counter > 0 && !self.countdownStarted) { self.countdownStarted = true; var countdownInterval = LK.setInterval(function () { self.counter--; countdownText.setText(self.counter.toString()); if (self.counter === 0) { LK.clearInterval(countdownInterval); game.removeChild(self); isPaused = false; // Unpause the game after countdown } }, 1000); } }; LK.on('tick', self.update); }); var GUIAnimation = Container.expand(function (target, changeFactor, animationFrames, animationType, onComplete) { var self = Container.call(this); self.target = target; self.changeFactor = changeFactor; self.animationFrames = animationFrames; self.currentFrame = 0; self.animationType = animationType; self.onComplete = onComplete; self.updateAnimation = function () { if (self.currentFrame < self.animationFrames) { switch (self.animationType) { case 'scale': self.target.scale.x *= 1 - self.changeFactor * (self.currentFrame / self.animationFrames); self.target.scale.y *= 1 - self.changeFactor * (self.currentFrame / self.animationFrames); break; case 'slide': self.target.x += self.changeFactor * (self.currentFrame / self.animationFrames) * 2048; // Slide to the right break; // Other animation types can be added here } self.currentFrame++; } else { LK.off('tick', self.updateAnimation); if (self.onComplete) { self.onComplete(); } } }; self.start = function () { LK.on('tick', self.updateAnimation); }; }); var ScaleAnimation = Container.expand(function (target, scaleFactor, animationFrames) { var self = Container.call(this); self.target = target; self.originalScaleX = target.scale.x; self.originalScaleY = target.scale.y; self.scaleFactor = scaleFactor; self.animationFrames = animationFrames; self.currentFrame = 0; self.updateAnimation = function () { if (self.currentFrame < self.animationFrames) { self.target.scale.x = self.originalScaleX * (1 - self.scaleFactor * (self.currentFrame / self.animationFrames)); self.target.scale.y = self.originalScaleY * (1 - self.scaleFactor * (self.currentFrame / self.animationFrames)); self.currentFrame++; } else { LK.off('tick', self.updateAnimation); if (self.onComplete) { self.onComplete(); } } }; self.start = function (onComplete) { self.onComplete = onComplete; LK.on('tick', self.updateAnimation); }; }); var GameSettings = Container.expand(function () { var self = Container.call(this); self.soundEnabled = true; self.difficulty = 'normal'; self.buttonTints = { easy: 0xFF0000, normal: 0x66ff00, hard: 0xFF0000, insane: 0xFF0000 }; self.buttonTints = { easy: 0xFF0000, normal: 0xFF0000, hard: 0xFF0000, insane: 0xFF0000 }; self.toggleSound = function () { self.soundEnabled = !self.soundEnabled; }; self.setDifficulty = function (difficulty) { self.difficulty = difficulty; }; self.setButtonTint = function (difficulty, tint) { self.buttonTints[difficulty] = tint; }; }); var SettingsGUI = Container.expand(function () { var self = Container.call(this); function animateButtonZoom(button) { var originalScaleX = button.scale.x; var originalScaleY = button.scale.y; var scaleFactor = 1.05; var animationFrames = 15; var currentFrame = 0; function updateAnimation() { if (currentFrame < animationFrames) { button.scale.x = originalScaleX * (1 + (scaleFactor - 1) * (currentFrame / animationFrames)); button.scale.y = originalScaleY * (1 + (scaleFactor - 1) * (currentFrame / animationFrames)); currentFrame++; } else { button.scale.x = originalScaleX; button.scale.y = originalScaleY; LK.off('tick', updateAnimation); } } LK.on('tick', updateAnimation); } var background = self.createAsset('settingsBackground', 'Settings GUI Background', 0.5, 0.5); background.curve = 5; var closeButton = self.createAsset('closeButton', 'Close button', 0.5, 0.5); closeButton.x = background.width / 2 - closeButton.width / 2; closeButton.y = -background.height / 2 - closeButton.height / 2; self.addChild(background); self.addChild(closeButton); // Add 'Set Your Difficulty' text over the Settings GUI var difficultyText = new Text2('Set Your Difficulty', { size: 110, // 10% bigger font size fill: '#ffffff', // White color font: 'bold', // Bold font stroke: '#000000', // Black outline strokeThickness: 10 // Outline thickness }); difficultyText.anchor.set(0.5, 0); difficultyText.x = 0; difficultyText.y = -background.height / 2 + 210; self.addChild(difficultyText); // Add 'Settings In The Works!' text under the difficulty title var settingsText = new Text2('Settings In The Works!', { size: 100, fill: '#ffffff', stroke: '#000000', strokeThickness: 8 }); settingsText.anchor.set(0.5, 0); settingsText.x = 0; settingsText.y = -background.height / 4 + 1250; self.addChild(settingsText); closeButton.on('down', function () { self.animateClose(); }); self.animateClose = function () { var currentDifficulty = gameSettings.difficulty; var animation = new GUIAnimation(self, 0.1, 10, 'slide', function () { self.unpauseGame(currentDifficulty); }); animation.start(); }; SettingsGUI.prototype.unpauseGame = function (currentDifficulty) { if (this.parent) { this.parent.removeChild(this); } settingsButton.visible = true; timerTxt.visible = true; scoreTxt.visible = true; var countdown = new Countdown(); game.addChild(countdown); countdown.update(); // Countdown will start here, so game remains paused updateButtonColors(currentDifficulty); }; // Add difficulty selection buttons var buttonPadding = 10; var easyButton = self.createAsset('easyButton', 'Easy Difficulty', 0.5, 0.5); easyButton.tint = 0xFF0000; // Set button color to bright red var easyButtonText = new Text2('Easy', { size: 100, fill: '#ffffff', font: 'bold', stroke: '#000000', strokeThickness: 8 }); easyButtonText.anchor.set(0.5, 0.5); easyButtonText.x = 0; easyButtonText.y = 0; easyButton.addChild(easyButtonText); self.addChild(easyButton); easyButton.x = 0; easyButton.y = buttonPadding - 1250 + 350 + 30; var normalButton = self.createAsset('normalButton', 'Normal Difficulty', 0.5, 0.5); normalButton.tint = 0x66ff00; // Set button color to green var normalButtonText = new Text2('Normal', { size: 100, fill: '#ffffff', font: 'bold', stroke: '#000000', strokeThickness: 8 }); normalButtonText.anchor.set(0.5, 0.5); normalButtonText.x = 0; normalButtonText.y = 0; normalButton.addChild(normalButtonText); self.addChild(normalButton); normalButton.x = 0; normalButton.y = easyButton.y + easyButton.height + buttonPadding; var hardButton = self.createAsset('hardButton', 'Hard Difficulty', 0.5, 0.5); hardButton.tint = 0xFF0000; // Set button color to bright red var hardButtonText = new Text2('Hard', { size: 100, fill: '#ffffff', font: 'bold', stroke: '#000000', strokeThickness: 8 }); hardButtonText.anchor.set(0.5, 0.5); hardButtonText.x = 0; hardButtonText.y = 0; hardButton.addChild(hardButtonText); self.addChild(hardButton); hardButton.x = 0; hardButton.y = normalButton.y + normalButton.height + buttonPadding; var insaneButton = self.createAsset('insaneButton', 'Insane Difficulty', 0.5, 0.5); insaneButton.tint = 0xFF0000; // Override the default color to red insaneButton.on('down', function () { easyButton.tint = 0xFF0000; // Revert to red normalButton.tint = 0xFF0000; // Revert to red hardButton.tint = 0xFF0000; // Revert to red gameSettings.setDifficulty('insane'); }); var insaneButtonText = new Text2('Insane', { size: 100, fill: '#ffffff', font: 'bold', stroke: '#000000', strokeThickness: 8 }); insaneButtonText.anchor.set(0.5, 0.5); insaneButtonText.x = 0; insaneButtonText.y = 0; insaneButton.addChild(insaneButtonText); self.addChild(insaneButton); insaneButton.x = 0; insaneButton.y = hardButton.y + hardButton.height + buttonPadding; self.addChild(easyButton); self.addChild(normalButton); self.addChild(hardButton); easyButton.lastClickTime = 0; easyButton.on('down', function () { var currentTime = Date.now(); if (currentTime - easyButton.lastClickTime >= 1000) { gameSettings.setDifficulty('easy'); updateButtonColors('easy'); animateButtonZoom(easyButton); easyButton.lastClickTime = currentTime; } }); normalButton.lastClickTime = 0; normalButton.on('down', function () { var currentTime = Date.now(); if (currentTime - normalButton.lastClickTime >= 1000) { gameSettings.setDifficulty('normal'); updateButtonColors('normal'); animateButtonZoom(normalButton); normalButton.lastClickTime = currentTime; } }); hardButton.lastClickTime = 0; hardButton.on('down', function () { var currentTime = Date.now(); if (currentTime - hardButton.lastClickTime >= 1000) { gameSettings.setDifficulty('hard'); updateButtonColors('hard'); animateButtonZoom(hardButton); hardButton.lastClickTime = currentTime; } }); insaneButton.lastClickTime = 0; insaneButton.on('down', function () { var currentTime = Date.now(); if (currentTime - insaneButton.lastClickTime >= 1000) { gameSettings.setDifficulty('insane'); updateButtonColors('insane'); animateButtonZoom(insaneButton); insaneButton.lastClickTime = currentTime; } }); function updateButtonColors(currentDifficulty) { easyButton.tint = currentDifficulty === 'easy' ? 0x66ff00 : 0xFF0000; normalButton.tint = currentDifficulty === 'normal' ? 0x66ff00 : 0xFF0000; hardButton.tint = currentDifficulty === 'hard' ? 0x66ff00 : 0xFF0000; insaneButton.tint = currentDifficulty === 'insane' ? 0x66ff00 : 0xFF0000; } }); // Initialize game settings var SettingsButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('settingsButton', 'Settings button', 0.5, 0.5); self.addChild(buttonGraphics); self.x = 2048 - buttonGraphics.width / 2 - 10; // Position from the right edge self.y = buttonGraphics.height / 2 + 10; // Position from the top edge var settingsGUI = null; self.on('down', function (obj) { if (settingsGUI && game.children.includes(settingsGUI)) { settingsGUI.animateClose(); } else if (!self.clickDisabled) { self.pauseGame(); } }); SettingsButton.prototype.pauseGame = function () { timerTxt.visible = false; scoreTxt.visible = false; this.isDown = true; var rotateAndZoomAnimation = new RotateAndZoomAnimation(this, 0.1, 10, 1); rotateAndZoomAnimation.start(function () { self.visible = false; isPaused = true; // Pause the game when settings are opened self.scale.x = 1; self.scale.y = 1; // Reset scale after animation LK.setTimeout(function () { self.clickDisabled = false; }, 4000); // Disable click for 4 seconds self.clickDisabled = true; }); }; self.on('up', function (obj) { if (self.isDown) { self.isDown = false; self.scale.x /= 1.05; self.scale.y /= 1.05; if (!settingsGUI || !game.children.includes(settingsGUI)) { settingsGUI = new SettingsGUI(); settingsGUI.x = 2048 / 2; settingsGUI.y = 2732 / 2; game.addChild(settingsGUI); } } }); self.on('upoutside', function (obj) { if (self.isDown) { self.isDown = false; self.scale.x /= 1.05; self.scale.y /= 1.05; } }); self.on('over', function (obj) { if (!self.isDown) { self.scale.x *= 1.05; self.scale.y *= 1.05; } }); self.on('out', function (obj) { if (!self.isDown) { self.scale.x /= 1.05; self.scale.y /= 1.05; } }); }); // ShadowGraphics class for shadow visuals var ShadowGraphics = Container.expand(function () { var self = Container.call(this); var graphics = self.createAsset('shadow', 'Shadow effect', 0.5, 0.5); // Additional visual enhancements for shadow can be added here }); // Splash effect class var Splash = Container.expand(function () { var self = Container.call(this); // Replace basic splash graphics with enhanced SplashGraphics var splashGraphics = new SplashGraphics(); self.addChild(splashGraphics); self.lifeSpan = 30; // Frames until splash fades out self.update = function () { self.alpha -= 1 / self.lifeSpan; if (self.alpha <= 0) { self.destroy(); } // Destroy splash when faded out }; LK.on('tick', self.update); }); // SplashGraphics class for enhanced splash visuals var SplashGraphics = Container.expand(function () { var self = Container.call(this); var graphics = self.createAsset('splash', 'Splash effect', 0.5, 0.5); // Additional visual enhancements can be added here }); // Replace basic splash graphics with enhanced SplashGraphics // Function to create a splash effect var Particle = Container.expand(function () { var self = Container.call(this); var particleGraphics = new ParticleGraphics(); self.addChild(particleGraphics); self.lifeSpan = 60; // Frames until particle fades out self.update = function () { self.alpha -= 1 / self.lifeSpan; if (self.alpha <= 0) { self.destroy(); } // Destroy particle when faded out }; }); var ParticlePool = Container.expand(function () { var self = Container.call(this); self.pool = []; self.maxParticles = 100; self.getParticle = function () { for (var i = 0; i < self.pool.length; i++) { if (self.pool[i].alpha <= 0) { return self.pool[i]; } } if (self.pool.length < self.maxParticles) { var newParticle = new Particle(); self.pool.push(newParticle); return newParticle; } return null; }; self.update = function () { self.pool.forEach(function (particle) { if (particle.alpha > 0) { particle.update(); } }); }; LK.on('tick', self.update); }); // TimerParticle class for unique TimerItem particle visuals var TimerParticle = Container.expand(function () { var self = Container.call(this); var graphics = self.createAsset('timerParticle', 'Timer item particle', 0.5, 0.5); self.lifeSpan = 60; // Frames until particle fades out self.update = function () { self.alpha -= 1 / self.lifeSpan; if (self.alpha <= 0) { self.destroy(); } // Destroy particle when faded out }; LK.on('tick', self.update); }); // TimerParticlePool class for pooling TimerItem's unique particles var TimerParticlePool = Container.expand(function () { var self = Container.call(this); self.pool = []; self.maxParticles = 100; self.getParticle = function () { for (var i = 0; i < self.pool.length; i++) { if (self.pool[i].alpha <= 0) { return self.pool[i]; } } if (self.pool.length < self.maxParticles) { var newParticle = new TimerParticle(); self.pool.push(newParticle); return newParticle; } return null; }; self.update = function () { self.pool.forEach(function (particle) { if (particle.alpha > 0) { particle.update(); } }); }; LK.on('tick', self.update); }); // Initialize the particle pool // ParticleGraphics class for enhanced particle visuals var ParticleGraphics = Container.expand(function () { var self = Container.call(this); var graphics = LK.getAsset('particle', 'Ball trail particle', 0.5, 0.5); self.addChild(graphics); // Additional visual enhancements can be added here }); // CoffeeBean class var CoffeeBean = Container.expand(function () { var self = Container.call(this); self.particlePool = new ParticlePool(); self.createParticle = function () { var particle = this.particlePool.getParticle(); if (particle) { particle.x = self.x; particle.y = self.y; particle.alpha = 1; // Reset particle alpha if (!self.isDestroyed && game.children.includes(self)) { game.addChildAt(particle, game.getChildIndex(self)); } } }; // Use CoffeeBeanGraphics for coffee bean visuals var coffeeBeanGraphics = new CoffeeBeanGraphics(); var shadowGraphics = new ShadowGraphics(); shadowGraphics.y = coffeeBeanGraphics.height * 0.1; shadowGraphics.alpha = 0.5; self.addChild(shadowGraphics); self.addChild(coffeeBeanGraphics); self.speed = Math.random() * 3 + 2; // Score value for each coffee bean based on difficulty self.scoreValue = gameSettings.difficulty === 'hard' ? 10 : gameSettings.difficulty === 'insane' ? 15 : gameSettings.difficulty === 'easy' ? 3 : 5; self.move = function () { var speedMultiplier = gameSettings.difficulty === 'hard' ? 16 : gameSettings.difficulty === 'insane' ? 40 : gameSettings.difficulty === 'easy' ? 4 : 8; self.y += self.speed * speedMultiplier; self.createParticle(); }; self.resetPosition = function () { self.x = Math.random() * (2048 - coffeeBeanGraphics.width) + coffeeBeanGraphics.width / 2; self.y = -coffeeBeanGraphics.height; }; self.isDestroyed = false; self.resetPosition(); }); // CoffeeBeanGraphics class for enhanced coffee bean visuals var CoffeeBeanGraphics = Container.expand(function () { var self = Container.call(this); var graphics = self.createAsset('coffeeBean', 'Coffee bean graphics', 0.5, 0.5); // Additional visual enhancements can be added here }); // Replace basic particle graphics with enhanced ParticleGraphics // Ball class var Ball = Container.expand(function () { var self = Container.call(this); self.particlePool = new ParticlePool(); self.createParticle = function () { var particle = this.particlePool.getParticle(); if (particle) { particle.x = self.x; particle.y = self.y; particle.alpha = 1; // Reset particle alpha if (!self.isDestroyed && game.children.includes(self)) { game.addChildAt(particle, game.getChildIndex(self)); } } }; // Use BallGraphics for ball visuals var ballGraphics = new BallGraphics(); var shadowGraphics = new ShadowGraphics(); shadowGraphics.y = ballGraphics.height * 0.1; shadowGraphics.alpha = 0.5; self.addChild(shadowGraphics); self.addChild(ballGraphics); self.speed = Math.random() * 3 + 2; // Score value for each ball based on difficulty self.scoreValue = gameSettings.difficulty === 'hard' ? 2 : gameSettings.difficulty === 'insane' ? 3 : gameSettings.difficulty === 'easy' ? 1 : 1; self.move = function () { var speedMultiplier = gameSettings.difficulty === 'hard' ? 4 : gameSettings.difficulty === 'insane' ? 10 : gameSettings.difficulty === 'easy' ? 1 : 2; self.y += self.speed * speedMultiplier; self.createParticle(); }; self.resetPosition = function () { self.x = Math.random() * (2048 - ballGraphics.width) + ballGraphics.width / 2; self.y = -ballGraphics.height; }; self.isDestroyed = false; self.resetPosition(); }); // TimerItem class var TimerItem = Container.expand(function () { var self = Container.call(this); var timerItemGraphics = self.createAsset('timerItem', 'Falling timer item', 0.5, 0.5); var shadowGraphics = new ShadowGraphics(); shadowGraphics.y = timerItemGraphics.height * 0.1; shadowGraphics.alpha = 0.5; self.addChild(shadowGraphics); self.addChild(timerItemGraphics); self.speed = Math.random() * 3 + 2; self.move = function () { var speedMultiplier = gameSettings.difficulty === 'hard' ? 12 : gameSettings.difficulty === 'insane' ? 30 : gameSettings.difficulty === 'easy' ? 3 : 6; self.y += self.speed * speedMultiplier; self.createParticle(); }; self.resetPosition = function () { self.x = Math.random() * (2048 - timerItemGraphics.width) + timerItemGraphics.width / 2; self.y = -timerItemGraphics.height; }; self.isDestroyed = false; self.resetPosition(); self.particlePool = new TimerParticlePool(); self.createParticle = function () { var particle = self.particlePool.getParticle(); if (particle) { particle.x = self.x; particle.y = self.y; particle.alpha = 1; // Reset particle alpha if (!self.isDestroyed && game.children.includes(self)) { game.addChildAt(particle, game.getChildIndex(self)); } } }; }); // BallGraphics class for enhanced ball visuals var BallGraphics = Container.expand(function () { var self = Container.call(this); var graphics = self.createAsset('ball', 'Ball graphics', 0.5, 0.5); // Additional visual enhancements can be added here }); // CoffeeCup class var CoffeeCup = Container.expand(function () { var self = Container.call(this); var cupGraphics = new CupGraphics(); self.addChild(cupGraphics); self.x = 2048 / 2; self.y = 2732 - cupGraphics.height / 2; self.intersects = function (ball) { var bounds = self.getBounds(); var ballBounds = ball.getBounds(); if (bounds.x < ballBounds.x + ballBounds.width && bounds.x + bounds.width > ballBounds.x && bounds.y < ballBounds.y + ballBounds.height && bounds.y + bounds.height > ballBounds.y) { LK.setScore(LK.getScore() + ball.scoreValue); timerSeconds += gameSettings.difficulty === 'hard' ? 5 : gameSettings.difficulty === 'insane' ? 5 : gameSettings.difficulty === 'easy' ? 20 : 1; // Add 1 second to the timer updateScoreDisplay(); timerTxt.setText(timerSeconds.toString()); // Update the timer display instantly LK.effects.flashObject(ball, 0xffff00, 300); // Add a yellow glow effect to the ball for 300ms when caught self.animate(); // Trigger cup animation when a ball is collected return true; } return false; }; self.animate = function () { var originalScaleX = self.scale.x; var originalScaleY = self.scale.y; var scaleFactor = 1.1; var animationFrames = 7.5; var currentFrame = 0; var grow = true; function updateAnimation() { if (currentFrame < animationFrames) { if (grow) { self.scale.x = originalScaleX * (1 + (scaleFactor - 1) * (currentFrame / animationFrames)); self.scale.y = originalScaleY * (1 + (scaleFactor - 1) * (currentFrame / animationFrames)); } else { self.scale.x = originalScaleX * (1 + (scaleFactor - 1) * (1 - currentFrame / animationFrames)); self.scale.y = originalScaleY * (1 + (scaleFactor - 1) * (1 - currentFrame / animationFrames)); } currentFrame++; } else if (grow) { grow = false; currentFrame = 0; } else { self.scale.x = originalScaleX; self.scale.y = originalScaleY; LK.off('tick', updateAnimation); } } if (!self.animationCooldown) { self.animationCooldown = true; LK.setTimeout(function () { self.animationCooldown = false; }, 500); LK.on('tick', updateAnimation); } }; }); // CupGraphics class for enhanced cup visuals var CupGraphics = Container.expand(function () { var self = Container.call(this); var graphics = self.createAsset('cup', 'Cup to catch balls', 0.5, 1); // Additional visual enhancements can be added here }); /**** * Initialize Game ****/ // Replace basic cup graphics with enhanced CupGraphics var game = new LK.Game({ backgroundColor: 0x00000000 //Set game background to invisible }); /**** * Game Code ****/ // Initialize game settings // Create and set the new background // Function to create a splash effect // Replace basic splash graphics with enhanced SplashGraphics // Function to create a splash effect function updateFallingObjects() { // Move existing falling objects balls.forEach(function (ball) { ball.move(); }); // Handle off-screen falling objects for (var i = balls.length - 1; i >= 0; i--) { if (balls[i].y > 2732 || balls[i].isDestroyed) { balls[i].destroy(); balls.splice(i, 1); } } // Spawn new falling objects if (LK.ticks % 60 == 0) { spawnFallingObjects(); } } var gameSettings = new GameSettings(); game.showSettingsGUI = function () { var settingsGUI = new SettingsGUI(); settingsGUI.x = 2048 / 2; settingsGUI.y = 2732 / 2; LK.gui.top.addChild(settingsGUI); }; var particlePool = new ParticlePool(); function createSplash(x, y) { var splash = new Splash(); splash.x = x; splash.y = y; if (!game.children.includes(splash)) { game.addChildAt(splash, game.children.length - 1); } } var background = game.createAsset('background', 'Game background', 0, 0); background.x = 0; // Set to top left on the x-axis background.y = 0; // Set to top left on the y-axis game.addChild(background); // Initialize game elements var balls = []; var cup = game.addChild(new CoffeeCup()); var score = 0; var requiredScore = 10; // The score needed to win var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#ffffff" }); var timerTxt = new Text2('60', { size: 100, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); timerTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); LK.gui.top.addChild(timerTxt); timerTxt.y = scoreTxt.height + 20; // Add settings button to the top left of the screen var settingsButton = new SettingsButton(); game.addChild(settingsButton); // Create a function to update the score display function updateScoreDisplay() { scoreTxt.setText(score.toString()); } var FallingObjectFactory = { createObject: function createObject(type) { var object; switch (type) { case 'coffeeBean': object = new CoffeeBean(); break; case 'timerItem': object = new TimerItem(); break; case 'ball': default: object = new Ball(); break; } balls.push(object); game.addChildAt(object, game.getChildIndex(settingsButton) - 1); return object; } }; function spawnFallingObjects() { var randomChance = Math.random(); if (randomChance < 0.05) { FallingObjectFactory.createObject('coffeeBean'); } else if (randomChance >= 0.05 && randomChance < 0.06) { FallingObjectFactory.createObject('timerItem'); } else { FallingObjectFactory.createObject('ball'); } } // Create a function to end the game function endGame() { // Game over logic will be handled in the tick function when timer hits 0 } // Create a function to handle ball and cup collisions function handleCollisions() { for (var i = balls.length - 1; i >= 0; i--) { if (cup.intersects(balls[i])) { if (balls[i] instanceof TimerItem) { timerSeconds += 10; // Add 10 seconds to the timer } else { if (canCollectScore) { score += balls[i].scoreValue; updateScoreDisplay(); } } createSplash(balls[i].x, balls[i].y); balls[i].destroy(); balls.splice(i, 1); } else if (balls[i].y > 2732) { balls[i].destroy(); balls.splice(i, 1); } } } // Create a function to handle dragging the cup function handleDrag(obj) { var event = obj.event; var pos = event.getLocalPosition(game); cup.x = pos.x; } // Add event listeners for dragging the cup game.on('down', function (obj) { if (!isPaused) { handleDrag(obj); } }); game.on('move', function (obj) { if (!isPaused) { handleDrag(obj); } }); // Main game loop // Removed the gameTimer as the game over logic will be handled in the tick function var timerSeconds = 60; var canCollectScore = false; var isPaused = false; LK.setTimeout(function () { canCollectScore = true; }, 100); LK.on('tick', function () { // Update timer display and check for game over if (!isPaused && LK.ticks % 60 == 0) { if (timerSeconds > 0) { timerSeconds--; timerTxt.setText(timerSeconds.toString()); } else { LK.effects.flashScreen(score >= requiredScore ? 0x00ff00 : 0xff0000, 1000); LK.showGameOver(); } } // Handle collisions handleCollisions(); // Update falling objects if (!isPaused) { updateFallingObjects(); } });
===================================================================
--- original.js
+++ change.js
@@ -543,9 +543,10 @@
shadowGraphics.alpha = 0.5;
self.addChild(shadowGraphics);
self.addChild(coffeeBeanGraphics);
self.speed = Math.random() * 3 + 2;
- self.scoreValue = 5; // Default score value for each coffee bean
+ // Score value for each coffee bean based on difficulty
+ self.scoreValue = gameSettings.difficulty === 'hard' ? 10 : gameSettings.difficulty === 'insane' ? 15 : gameSettings.difficulty === 'easy' ? 3 : 5;
self.move = function () {
var speedMultiplier = gameSettings.difficulty === 'hard' ? 16 : gameSettings.difficulty === 'insane' ? 40 : gameSettings.difficulty === 'easy' ? 4 : 8;
self.y += self.speed * speedMultiplier;
self.createParticle();
@@ -586,9 +587,10 @@
shadowGraphics.alpha = 0.5;
self.addChild(shadowGraphics);
self.addChild(ballGraphics);
self.speed = Math.random() * 3 + 2;
- self.scoreValue = 1; // Default score value for each ball
+ // Score value for each ball based on difficulty
+ self.scoreValue = gameSettings.difficulty === 'hard' ? 2 : gameSettings.difficulty === 'insane' ? 3 : gameSettings.difficulty === 'easy' ? 1 : 1;
self.move = function () {
var speedMultiplier = gameSettings.difficulty === 'hard' ? 4 : gameSettings.difficulty === 'insane' ? 10 : gameSettings.difficulty === 'easy' ? 1 : 2;
self.y += self.speed * speedMultiplier;
self.createParticle();
Coffee droplet.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. Shadows at the bottom.
Have the coffee cup open at the top
High end Coffee Shop. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. Shadows at the bottom.
Coffee trail going vertical. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. Shadows at the bottom.
Coffee splashing effect. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No Shadows.
Black circle with a bit of transparency.
Coffee Bean With Nothing Else. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Clock, Nothing else in the image.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A white particle trail, vertical. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Remove the plus from this image
Red X. Nothing else.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White rectangle, curved corners. Small black border. Simple, modern. Aspect ratio 1550 * 2500.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Include only the spike.
Remove the bottom part that is not coming from the center explosion
Rectangular coffee themed start button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Remove the random stuff below the question mark
Coffee themed button which has the text "gamemode". Make the aspect ratio of this button 5:1. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.