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
===================================================================
--- original.js
+++ change.js
@@ -1,18 +1,51 @@
/****
* Classes
****/
+var GamemodeGUI = Container.expand(function () {
+ var self = Container.call(this);
+ var background = self.attachAsset('gamemodes', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.addChild(background);
+ // Additional GUI elements like buttons and text can be added here
+});
+var GamemodeButton = Container.expand(function () {
+ var self = Container.call(this);
+ var buttonGraphics = self.attachAsset('gamemodes', {
+ anchorX: 0.5,
+ anchorY: 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
+ self.on('down', function (obj) {
+ var gamemodeGUI = new GamemodeGUI();
+ gamemodeGUI.x = 2048 / 2;
+ gamemodeGUI.y = 2732 / 2;
+ if (!game.children.includes(gamemodeGUI)) {
+ game.addChild(gamemodeGUI);
+ }
+ });
+});
var ExplosionAsset = Container.expand(function () {
var self = Container.call(this);
this.preload = function () {
- var graphics = self.createAsset('explosion', 'Explosion effect', 0.5, 0.5);
+ 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 = self.createAsset('explosion', 'Explosion effect', 0.5, 0.5);
+ var explosionGraphics = self.attachAsset('explosion', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.addChild(explosionGraphics);
self.lifeSpan = 30; // Frames until explosion fades out
self.update = function () {
self.alpha -= 1 / self.lifeSpan;
@@ -23,9 +56,12 @@
LK.on('tick', self.update);
});
var DancingCup = Container.expand(function () {
var self = Container.call(this);
- var cupGraphics = self.createAsset('DancingCup', 'Animated dancing cup', 0.5, 0.5);
+ var cupGraphics = self.attachAsset('DancingCup', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.addChild(cupGraphics);
var animationSpeed = 0.1;
var animationDistance = 20;
var direction = 1;
@@ -253,11 +289,17 @@
}
}
LK.on('tick', updateAnimation);
}
- var background = self.createAsset('settingsBackground', 'Settings GUI Background', 0.5, 0.5);
+ var background = self.attachAsset('settingsBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
background.curve = 5;
- var closeButton = self.createAsset('closeButton', 'Close button', 0.5, 0.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);
@@ -323,9 +365,12 @@
}
};
// Add difficulty selection buttons
var buttonPadding = 10;
- var easyButton = self.createAsset('easyButton', 'Easy Difficulty', 0.5, 0.5);
+ 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',
@@ -339,9 +384,12 @@
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);
+ 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',
@@ -355,9 +403,12 @@
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);
+ 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',
@@ -371,9 +422,12 @@
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);
+ 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
@@ -402,9 +456,12 @@
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.createAsset('checkbox', 'Checkbox for disabling spikes', 0.5, 0.5);
+ 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 () {
@@ -476,9 +533,12 @@
});
// Initialize game settings
var SettingsButton = Container.expand(function () {
var self = Container.call(this);
- var buttonGraphics = self.createAsset('settingsButton', 'Settings button', 0.5, 0.5);
+ var buttonGraphics = self.attachAsset('settingsButton', {
+ anchorX: 0.5,
+ anchorY: 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 = new SettingsGUI();
@@ -548,9 +608,12 @@
});
// 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);
+ 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 () {
@@ -569,9 +632,12 @@
});
// 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);
+ 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
@@ -615,9 +681,12 @@
});
// 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);
+ 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) {
@@ -656,9 +725,12 @@
// 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);
+ var graphics = LK.getAsset('particle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.addChild(graphics);
// Additional visual enhancements can be added here
});
// CoffeeBean class
@@ -702,15 +774,21 @@
});
// 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);
+ 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.createAsset('spinningSpike', 'Spinning spike graphics', 0.5, 0.5);
+ 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
@@ -766,9 +844,12 @@
});
// 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 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);
@@ -803,9 +884,12 @@
});
// 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);
+ 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 () {
@@ -867,19 +951,28 @@
});
// 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);
+ 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.createAsset('startScreen', 'Start screen background', 0.5, 0.5);
+ 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.createAsset('startButton', 'Start game button', 0.5, 0.5);
+ 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', {
@@ -895,9 +988,12 @@
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.createAsset('helpButton', 'Help button', 0.5, 0.5);
+ 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 () {
@@ -940,15 +1036,21 @@
});
});
var HelpGUI = Container.expand(function () {
var self = Container.call(this);
- var helpAsset = self.createAsset('helpAsset', 'Help GUI asset', 0.5, 0.5);
+ 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', 'Home button', 0.5, 0.5);
+ 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 () {
@@ -965,9 +1067,12 @@
}
});
// Add information about the stagnant ball item
var ballInfoContainer = new Container();
- var ballAsset = LK.getAsset('ball', 'Stagnant ball item', 0.5, 0.5);
+ 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,
@@ -985,9 +1090,12 @@
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', 'Coffee bean item', 0.5, 0.5);
+ 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,
@@ -1005,9 +1113,12 @@
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', 'Timer item', 0.5, 0.5);
+ 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,
@@ -1025,9 +1136,12 @@
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', 'Spinning spike item', 0.5, 0.5);
+ 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',
@@ -1054,14 +1168,14 @@
/****
* Game Code
****/
-// Instantiate ExplosionAsset to preload the asset
+// 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
-// Create and set the new background
-// Initialize game settings
+// Instantiate ExplosionAsset to preload the asset
var explosionAsset = new ExplosionAsset();
function createExplosion(x, y) {
var explosion = new Explosion();
explosion.x = x;
@@ -1102,9 +1216,9 @@
if (!game.children.includes(splash)) {
game.addChildAt(splash, game.children.length - 1);
}
}
-var background = game.createAsset('background', 'Game background', 0, 0);
+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
@@ -1129,8 +1243,11 @@
// Add settings button to the top left of the screen
var settingsGUI;
var settingsButton = new SettingsButton();
game.addChild(settingsButton);
+// Add gamemode button to the top right of the screen
+var gamemodeButton = new GamemodeButton();
+game.addChild(gamemodeButton);
// Create a function to update the score display
function updateScoreDisplay() {
scoreTxt.setText(score.toString());
}
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.