User prompt
Move the set difficulty text down 50 pixels
User prompt
Move the set difficulty text down 100 pixels
User prompt
Move the settings button 50 pixels to the right and 50 pixels up
User prompt
Move the settings button 100 pixels to the left and 100 pixels down
User prompt
Move the "set the difficulty" text up 150
User prompt
Fix every single bug
User prompt
Move the gamemode button to the left of the start button
User prompt
Make the gamemode button visible when the game first starts.
User prompt
Add a new button called gamemode. When this button is clicked, it brings up the gamemode gui. Use the gamemodes asset.
User prompt
Fix Bug: 'ReferenceError: ExplosionGraphics is not defined' in this line: 'var explosionGraphics = new ExplosionGraphics();' Line Number: 14
User prompt
Preload the explosion asset
User prompt
In the spinning spikes text, make the text after "costs!*" on the next line
Code edit (4 edits merged)
Please save this source code
User prompt
In the helpgui, add a new spinning spike help 30 pixels below the timer help. The spinning spike help will have the following text. ". *Avoid the spinning spike at all costs!* This item will make you lose 10 score!" Format the timer help the exact way as the coffee drop is formatted in the helpgui. Do not format the text lines. Make sure it is a copy of the spinning spikes asset without rotation.
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'y')' in this line: 'spinningSpikeInfoContainer.y = timerInfoContainer.y + timerInfoContainer.height + 30;' Line Number: 957
User prompt
In the helpgui, add a new spinning spike help 30 pixels below the timer help. The spinning spike help will have the following text. ". *Avoid the spinning spike at all costs!* This item will make you lose 10 score!" Format the timer help the exact way as the coffee drop is formatted in the helpgui. Do not format the text lines.
Code edit (1 edits merged)
Please save this source code
User prompt
With the timer text in the help gui, put the text after countdown. on a new line.
User prompt
In the helpgui, add a new timer help 30 pixels below the coffee bean help. The timer help will have the following text. "Collect the Timer for +5 on the countdown. *WARNING! THIS ITEM FALLS DOWN FAST!*" Format the timer help the exact way as the coffee drop is formatted in the helpgui. Do not format the text lines.
User prompt
In the help gui, coffee bean text, put the text after gamemodes. on the next line
User prompt
In the help gui, coffee bean text, put the text after countdown on the next line
User prompt
Format the coffee bean help the exact way as the coffee drop is formatted in the helpgui. Do not format the text lines.
User prompt
In the helpgui, add a new coffee bean help 30 pixels below the ball help. The coffee bean help will have the following text. "Collect the Coffee Bean for +5 score. +1 on the countdown for easy and normal gamemodes. *WARNING! THIS ITEM FALLS DOWN FAST!*"
Code edit (3 edits merged)
Please save this source code
User prompt
add a 10 degree rotation to the ball and the ball text in the helpgui
/**** * Classes ****/ var ExplosionAsset = Container.expand(function () { var self = Container.call(this); this.preload = function () { var graphics = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5 }); }; this.preload(); }); // Instantiate ExplosionAsset to preload the asset var Explosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = new ExplosionGraphics(); self.addChild(explosionGraphics); self.lifeSpan = 30; // Frames until explosion fades out self.update = function () { self.alpha -= 1 / self.lifeSpan; if (self.alpha <= 0) { self.destroy(); } // Destroy explosion when faded out }; LK.on('tick', self.update); }); var DancingCup = Container.expand(function () { var self = Container.call(this); var cupGraphics = self.attachAsset('DancingCup', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(cupGraphics); var animationSpeed = 0.1; var animationDistance = 20; var direction = 1; cupGraphics.rotation = -35 * (Math.PI / 180); self.updateDance = function () { var rotationSpeed = 70 * (Math.PI / 180); var stayDuration = 60; // 1 second at 60FPS if (self.stayCounter > 0) { self.stayCounter--; return; } cupGraphics.rotation += (self.reverseAnimation ? -1 : 1) * direction * rotationSpeed; if (Math.abs(cupGraphics.rotation) >= rotationSpeed) { direction *= -1; self.stayCounter = stayDuration; } }; self.stayCounter = 0; LK.on('tick', self.updateDance); }); var StartButtonAnimation = Container.expand(function (startButton) { var self = Container.call(this); self.startButton = startButton; var minX = game.width / 2 - 10; var maxX = game.width / 2 + 10; var speed = 0.5; // Speed of the animation var direction = 1; // Start moving to the right self.updateAnimation = function () { if (!isPaused) { self.startButton.x += speed * direction; if (self.startButton.x > maxX || self.startButton.x < minX) { direction *= -1; // Reverse direction } } }; LK.on('tick', self.updateAnimation); }); // CountdownTimer class to manage the 60-second countdown var CountdownTimer = Container.expand(function (duration, displayText, onComplete) { var self = Container.call(this); self.duration = duration; self.displayText = displayText; self.onComplete = onComplete; self.update = function () { if (!isPaused && LK.ticks % 60 == 0) { if (self.duration > 0) { self.duration--; self.displayText.setText(self.duration.toString()); } else if (self.duration === 0) { LK.showGameOver(); } } }; }); 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); Countdown.prototype.animateDownwards = function () { var startY = self.y; var endY = 2732 / 2 + 200; // Move 200 pixels downwards from the center var frames = 20; // Animation duration of 1/3 second at 60FPS var currentFrame = 0; function updateAnimation() { if (currentFrame < frames) { var progress = currentFrame / frames; self.y = startY + (endY - startY) * progress; currentFrame++; } else { LK.off('tick', updateAnimation); game.removeChild(self); } } LK.on('tick', updateAnimation); }; self.counter = 3; var countdownText = new Text2(self.counter.toString(), { size: 200, fill: '#00ff00', // Green color stroke: '#000000', // Black stroke strokeThickness: 8, // Stroke thickness 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); self.animateDownwards(); 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 = typeof LK.localStorage !== 'undefined' ? LK.localStorage.getItem('selectedDifficulty') || 'normal' : 'normal'; self.toggleSound = function () { self.soundEnabled = !self.soundEnabled; }; self.setDifficulty = function (difficulty) { self.difficulty = difficulty; // Persist the selected difficulty if (typeof LK.localStorage !== 'undefined') { LK.localStorage.setItem('selectedDifficulty', 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.attachAsset('settingsBackground', { anchorX: 0.5, anchorY: 0.5 }); background.curve = 5; var closeButton = self.attachAsset('closeButton', { anchorX: 0.5, anchorY: 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; // Only start countdown if not on start screen scoreTxt.visible = true; timerTxt.visible = true; if (gameSettings.disableSpikes) { balls = balls.filter(function (ball) { if (ball instanceof SpinningSpike) { createExplosion(ball.x, ball.y); ball.destroy(); return false; } return true; }); } if (!startScreen.parent) { var countdown = new Countdown(); game.addChild(countdown); countdown.update(); } }; // Add difficulty selection buttons var buttonPadding = 10; var easyButton = self.attachAsset('easyButton', { anchorX: 0.5, anchorY: 0.5 }); easyButton.tint = gameSettings.difficulty === 'easy' ? 0x66ff00 : 0xFF0000; // Set button color based on the current difficulty 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.attachAsset('normalButton', { anchorX: 0.5, anchorY: 0.5 }); normalButton.tint = gameSettings.difficulty === 'normal' ? 0x66ff00 : 0xFF0000; // Set button color based on the current difficulty 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.attachAsset('hardButton', { anchorX: 0.5, anchorY: 0.5 }); hardButton.tint = gameSettings.difficulty === 'hard' ? 0x66ff00 : 0xFF0000; // Set button color based on the current difficulty 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.attachAsset('insaneButton', { anchorX: 0.5, anchorY: 0.5 }); insaneButton.tint = gameSettings.difficulty === 'insane' ? 0x66ff00 : 0xFF0000; // Set button color based on the current difficulty 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); // Add 'Disable Spinning Spikes' setting with a checkbox var disableSpikesText = new Text2('Disable Spinning Spikes', { size: 100, fill: '#ffffff', stroke: '#000000', strokeThickness: 8 }); disableSpikesText.anchor.set(0, 0.5); disableSpikesText.x = -background.width / 4 - 225; disableSpikesText.y = insaneButton.y + insaneButton.height + buttonPadding / 2 - 500; self.addChild(disableSpikesText); var disableSpikesCheckbox = self.attachAsset('checkbox', { anchorX: 0.5, anchorY: 0.5 }); disableSpikesCheckbox.x = disableSpikesText.x + disableSpikesText.width + 120; disableSpikesCheckbox.y = disableSpikesText.y; self.addChild(disableSpikesCheckbox); disableSpikesCheckbox.on('down', function () { gameSettings.disableSpikes = !gameSettings.disableSpikes; // Update the color of the checkbox based on the new setting state if (gameSettings.disableSpikes) { disableSpikesCheckbox.tint = 0x00FF00; // Set checkbox color to green } else { disableSpikesCheckbox.tint = 0xFF0000; // Set checkbox color to red } }); // Set the initial state of disableSpikes based on gameSettings if (gameSettings.disableSpikes) { disableSpikesCheckbox.tint = 0x00FF00; // Set checkbox color to green } else { disableSpikesCheckbox.tint = 0xFF0000; // Set checkbox color to red } 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(gameSettings.difficulty); 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(gameSettings.difficulty); 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(gameSettings.difficulty); 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(gameSettings.difficulty); animateButtonZoom(insaneButton); insaneButton.lastClickTime = currentTime; } }); function updateButtonColors(selectedDifficulty) { easyButton.tint = selectedDifficulty === 'easy' ? 0x66ff00 : 0xFF0000; normalButton.tint = selectedDifficulty === 'normal' ? 0x66ff00 : 0xFF0000; hardButton.tint = selectedDifficulty === 'hard' ? 0x66ff00 : 0xFF0000; insaneButton.tint = selectedDifficulty === 'insane' ? 0x66ff00 : 0xFF0000; } }); // Initialize game settings var SettingsButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(buttonGraphics); self.x = 2048 - buttonGraphics.width / 2 - 60; // Position from the right edge and 50 pixels to the left self.y = buttonGraphics.height / 2 + 60; // Position from the top edge and 50 pixels down var settingsGUI = new SettingsGUI(); settingsGUI.x = 2048 / 2; settingsGUI.y = 2732 / 2; self.on('down', function (obj) { if (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 if (startScreen.parent) { LK.setTimeout(function () { self.clickDisabled = false; }, 1000); // Disable click for 1 second if start screen is up } else { LK.setTimeout(function () { self.clickDisabled = false; }, 4000); // Otherwise, 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.attachAsset('shadow', { anchorX: 0.5, anchorY: 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.attachAsset('splash', { anchorX: 0.5, anchorY: 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.attachAsset('timerParticle', { anchorX: 0.5, anchorY: 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', { anchorX: 0.5, anchorY: 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; self.scoreValue = 5; // Default score value for each coffee bean 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(); if (self.y > 2732) { self.isDestroyed = true; } }; 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.attachAsset('coffeeBean', { anchorX: 0.5, anchorY: 0.5 }); // Additional visual enhancements can be added here }); // SpinningSpike class var SpinningSpike = Container.expand(function () { var self = Container.call(this); var spikeGraphics = self.attachAsset('spinningSpike', { anchorX: 0.5, anchorY: 0.5 }); self.addChild(spikeGraphics); self.speed = Math.random() * 3 + 2; self.rotationSpeed = 4 * 2 * Math.PI; // 4 times per second self.scoreValue = -10; // Deducts points when collected self.move = function () { self.y += self.speed * 2; // Fall speed increased by 2 times self.rotation += self.rotationSpeed / 60; // Game runs at 60FPS if (self.y > 2732) { self.isDestroyed = true; } }; self.resetPosition = function () { self.x = Math.random() * (2048 - spikeGraphics.width) + spikeGraphics.width / 2; self.y = -spikeGraphics.height; }; self.resetPosition(); }); // 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; self.scoreValue = 1; // Default score value for each ball 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.attachAsset('timerItem', { anchorX: 0.5, anchorY: 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(); if (self.y > 2732) { self.isDestroyed = true; } }; 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.attachAsset('ball', { anchorX: 0.5, anchorY: 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 - 100; 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); if (!(ball instanceof TimerItem) && gameSettings.difficulty !== 'hard' && gameSettings.difficulty !== 'insane') { countdownTimer.duration += 1; } // Add time to the timer based on difficulty updateScoreDisplay(); timerTxt.setText(countdownTimer.duration.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.attachAsset('cup', { anchorX: 0.5, anchorY: 1 }); // Additional visual enhancements can be added here }); var StartScreen = Container.expand(function () { var self = Container.call(this); var startScreenBackground = self.attachAsset('startScreen', { anchorX: 0.5, anchorY: 0.5 }); startScreenBackground.tint = 0xF1E7D6; // very light brown color startScreenBackground.x = game.width / 2; startScreenBackground.y = game.height / 2; self.addChild(startScreenBackground); var startButton = self.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); startButton.x = game.width / 2; startButton.y = game.height / 2 + 1000; // Add 'Coffee Catcher' text to the start GUI var coffeeCatcherText = new Text2('Coffee Catcher', { size: 225, fill: '#8B4513', // Coffee color font: 'bold', stroke: '#000000', strokeThickness: 12 }); coffeeCatcherText.anchor.set(0.5, 0); coffeeCatcherText.x = game.width / 2; coffeeCatcherText.y = game.height / 2 - 850; // Position 100 pixels higher above the start button self.addChild(coffeeCatcherText); self.addChild(startButton); // Add new '?' button to the start GUI var helpButton = self.attachAsset('helpButton', { anchorX: 0.5, anchorY: 0.5 }); helpButton.x = game.width / 2 + 700; helpButton.y = game.height / 2 + 1000; self.addChild(helpButton); helpButton.on('down', function () { var helpGUI = new HelpGUI(); helpGUI.x = 2048 / 2; helpGUI.y = 2732 / 2; game.addChild(helpGUI); if (settingsGUI) { settingsGUI.visible = false; } }); // Add new asset 'DancingCup' to the start GUI var dancingCup1 = new DancingCup(); dancingCup1.x = game.width / 2 - 900; dancingCup1.y = game.height / 2 - 700; // Position to the left of the Coffee Catcher text self.addChild(dancingCup1); var dancingCup2 = new DancingCup(); dancingCup2.x = game.width / 2 + 900; dancingCup2.y = game.height / 2 - 700; // Position to the right of the Coffee Catcher text dancingCup2.reverseAnimation = true; // Flag to reverse the animation direction self.addChild(dancingCup2); // Add left to right motion animation to the start button startButton.on('over', function () { startButton.scale.x *= 1.05; startButton.scale.y *= 1.05; }); startButton.on('out', function () { startButton.scale.x /= 1.05; startButton.scale.y /= 1.05; }); startButton.on('down', function () { LK.gui.top.addChild(scoreTxt); // Add score text to GUI overlay LK.gui.top.addChild(timerTxt); // Add timer text to GUI overlay isPaused = false; // Start the closing animation for the start menu GUI var closeAnimation = new GUIAnimation(self, 0.1, 30, 'slide', function () { game.removeChild(self); }); closeAnimation.start(); }); }); var HelpGUI = Container.expand(function () { var self = Container.call(this); var helpAsset = self.attachAsset('helpAsset', { anchorX: 0.5, anchorY: 0.5 }); helpAsset.tint = 0xD2B48C; // Light brown color self.addChild(helpAsset); helpAsset.x = 0; helpAsset.y = 0; // Add a home button to the help GUI var homeButton = LK.getAsset('homeButton', { anchorX: 0.5, anchorY: 0.5 }); homeButton.x = 850; homeButton.y = -1250; // Position 1250 pixels above the center of the help GUI and 750 pixels to the right self.addChild(homeButton); homeButton.on('down', function () { // Remove the help GUI and show the start GUI game.removeChild(self); if (!game.children.includes(startScreen)) { startScreen.x = 2048 / 2; startScreen.y = 2732 / 2; game.addChild(startScreen); } if (settingsGUI && !game.children.includes(settingsGUI)) { game.addChild(settingsGUI); settingsGUI.visible = true; } }); // Add information about the stagnant ball item var ballInfoContainer = new Container(); var ballAsset = LK.getAsset('ball', { anchorX: 0.5, anchorY: 0.5 }); ballAsset.rotation = 10 * (Math.PI / 180); ballInfoContainer.addChild(ballAsset); var ballInfoText = new Text2('Collect the coffee drop for +1 score. +1 on the \ncountdown for easy and normal gamemodes.', { size: 50, fill: '#ffffff', anchor: { x: 0, y: 0.5 } }); ballInfoText.x = ballAsset.width - 20; ballInfoText.rotation = 5 * (Math.PI / 360); ballInfoContainer.addChild(ballInfoText); ballInfoContainer.x = -750; ballInfoContainer.y = homeButton.y + homeButton.height + 50; ballInfoText.y = ballAsset.height - 200; self.addChild(ballInfoContainer); // Add new coffee bean help below the ball help var coffeeBeanInfoContainer = new Container(); var coffeeBeanAsset = LK.getAsset('coffeeBean', { anchorX: 0.5, anchorY: 0.5 }); coffeeBeanAsset.rotation = 10 * (Math.PI / 180); coffeeBeanInfoContainer.addChild(coffeeBeanAsset); var coffeeBeanInfoText = new Text2('Collect the Coffee Bean for +5 score. +1 on the\ncountdown for easy and normal gamemodes.\n*WARNING! THIS ITEM FALLS DOWN FAST!*', { size: 50, fill: '#ffffff', anchor: { x: 0, y: 0.5 } }); coffeeBeanInfoText.x = coffeeBeanAsset.width - 20; coffeeBeanInfoText.rotation = 5 * (Math.PI / 360); coffeeBeanInfoContainer.addChild(coffeeBeanInfoText); coffeeBeanInfoContainer.x = -750; coffeeBeanInfoContainer.y = ballInfoContainer.y + ballInfoContainer.height + 50; coffeeBeanInfoText.y = coffeeBeanAsset.height - 200; self.addChild(coffeeBeanInfoContainer); // Add new timer help below the coffee bean help var timerInfoContainer = new Container(); var timerAsset = LK.getAsset('timerItem', { anchorX: 0.5, anchorY: 0.5 }); timerAsset.rotation = 10 * (Math.PI / 180); timerInfoContainer.addChild(timerAsset); var timerInfoText = new Text2('Collect the Timer for +5 on the countdown.\n*WARNING! THIS ITEM FALLS DOWN FAST!*', { size: 50, fill: '#ffffff', anchor: { x: 0, y: 0.5 } }); timerInfoText.x = timerAsset.width - 20; timerInfoText.rotation = 5 * (Math.PI / 360); timerInfoContainer.addChild(timerInfoText); timerInfoContainer.x = -750; timerInfoContainer.y = coffeeBeanInfoContainer.y + coffeeBeanInfoContainer.height + 30; timerInfoText.y = timerAsset.height - 200; self.addChild(timerInfoContainer); // Add new spinning spike help below the timer help var spinningSpikeInfoContainer = new Container(); var spinningSpikeAsset = LK.getAsset('spinningSpike', { anchorX: 0.5, anchorY: 0.5 }); spinningSpikeInfoContainer.addChild(spinningSpikeAsset); var spinningSpikeInfoText = new Text2('*Avoid the spinning spike at all costs!*\nThis item will make you lose 10 score!', { size: 50, fill: '#ffffff', anchor: { x: 0, y: 0.5 } }); spinningSpikeInfoText.x = spinningSpikeAsset.width - 20; spinningSpikeInfoText.rotation = 5 * (Math.PI / 360); spinningSpikeInfoContainer.addChild(spinningSpikeInfoText); spinningSpikeInfoContainer.x = -750; spinningSpikeInfoContainer.y = timerInfoContainer.y + timerInfoContainer.height + 30; self.addChild(spinningSpikeInfoContainer); }); /**** * Initialize Game ****/ // Replace basic cup graphics with enhanced CupGraphics var game = new LK.Game({ backgroundColor: 0x00000000 //Set game background to invisible }); /**** * Game Code ****/ // Instantiate ExplosionAsset to preload the asset // Function to create a splash effect // Replace basic splash graphics with enhanced SplashGraphics // Function to create a splash effect // Create and set the new background // Initialize game settings var explosionAsset = new ExplosionAsset(); function createExplosion(x, y) { var explosion = new Explosion(); explosion.x = x; explosion.y = y; if (!game.children.includes(explosion)) { game.addChildAt(explosion, game.children.length - 1); } } 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 > game.height || 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.attachAsset('background', {}); 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); // Initially hide the score and timer text // 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 settingsGUI; var settingsButton = new SettingsButton(); game.addChild(settingsButton); // Create a function to update the score display function updateScoreDisplay() { scoreTxt.setText(score.toString()); } var CoffeeBeanFactory = { createCoffeeBean: function createCoffeeBean() { var coffeeBean = new CoffeeBean(); balls.push(coffeeBean); game.addChildAt(coffeeBean, game.getChildIndex(settingsButton) - 1); return coffeeBean; } }; var TimerItemFactory = { createTimerItem: function createTimerItem() { var timerItem = new TimerItem(); balls.push(timerItem); game.addChildAt(timerItem, game.getChildIndex(settingsButton) - 1); return timerItem; } }; var BallFactory = { createBall: function createBall() { var ball = new Ball(); balls.push(ball); game.addChildAt(ball, game.getChildIndex(settingsButton) - 1); return ball; } }; function spawnFallingObjects() { var randomChance = Math.random(); var difficulty = gameSettings.difficulty; var spinningSpikeChance = difficulty === 'normal' ? 0.01 : difficulty === 'hard' ? 0.05 : difficulty === 'insane' ? 0.1 : 0; if (!gameSettings.disableSpikes && randomChance < spinningSpikeChance) { var spinningSpike = new SpinningSpike(); balls.push(spinningSpike); game.addChildAt(spinningSpike, game.getChildIndex(settingsButton) - 1); } else if (randomChance < 0.05 + spinningSpikeChance) { CoffeeBeanFactory.createCoffeeBean(); } else if (randomChance >= 0.05 + spinningSpikeChance && randomChance < 0.06 + spinningSpikeChance) { TimerItemFactory.createTimerItem(); } else { BallFactory.createBall(); } } // Create a function to end the game function endGame() { var finalScore = LK.getScore(); // Retrieve the current high score from localStorage var highScore = typeof LK.localStorage !== 'undefined' ? parseInt(LK.localStorage.getItem('highScore')) || 0 : 0; // Check if the final score is greater than the high score if (finalScore > highScore) { // Update the high score in localStorage if (typeof LK.localStorage !== 'undefined') { LK.localStorage.setItem('highScore', finalScore.toString()); } } LK.setTimeout(function () { LK.showGameOver(); }, 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) { countdownTimer.duration += 10; // Add 10 seconds to the timer } else { if (canCollectScore) { score += balls[i].scoreValue; if (balls[i] instanceof SpinningSpike && score < 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Prevent score from going negative 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 var canCollectScore = false; var isPaused = false; LK.setTimeout(function () { canCollectScore = true; }, 100); // Initialize the 60-second countdown timer var countdownTimer = new CountdownTimer(60, timerTxt, function () { LK.effects.flashScreen(score >= requiredScore ? 0x00ff00 : 0xff0000, 1000); LK.showGameOver(); }); var startScreen = new StartScreen(); startScreen.x = 2048 / 2 - 1000; startScreen.y = 2732 / 2 - 1500; game.addChild(startScreen); // Make settings button visible on start screen game.addChild(settingsButton); isPaused = true; // Initialize the 60-second countdown timer var countdownTimer = new CountdownTimer(60, timerTxt, function () { LK.effects.flashScreen(score >= requiredScore ? 0x00ff00 : 0xff0000, 1000); LK.showGameOver(); }); LK.on('tick', function () { // Update the countdown timer countdownTimer.update(); // Handle collisions handleCollisions(); // Update falling objects if (!isPaused) { updateFallingObjects(); } });
===================================================================
--- original.js
+++ change.js
@@ -286,9 +286,9 @@
strokeThickness: 10 // Outline thickness
});
difficultyText.anchor.set(0.5, 0);
difficultyText.x = 0;
- difficultyText.y = -background.height / 2 + 160;
+ 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,
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.