User prompt
Progress the visual development of the game by adding effects.
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'if (!self.isDestroyed && game.getChildIndex(self) !== -1) {' Line Number: 23
User prompt
Add a shadow reflection below the cup
User prompt
Add a shadow to the cup
User prompt
Make sure the ball particle is also below the cup
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'if (!self.isDestroyed && game.getChildIndex(self) !== -1) {' Line Number: 23
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'game.addChildAt(particle, game.getChildIndex(self));' Line Number: 24
User prompt
Make sure the particle is below the ball
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'game.addChildAt(particle, game.getChildIndex(self));' Line Number: 23
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'game.addChildAt(particle, game.getChildIndex(self));' Line Number: 23
User prompt
If a ball is gone, make the trail go away immediately
User prompt
make the particle trail layer below the ball
User prompt
Add a particle trail to the balls (which can be changed with an asset)
User prompt
Make the new background be at the top left of the screen
User prompt
Now make a new background with the background asset
User prompt
Set the background color to invisible
User prompt
The background is not showing as expected.
User prompt
Redo the background logic and make the background asset the background
User prompt
Make the asset "background" the background of this game.
User prompt
Bug: The background asset is not showing in game
User prompt
Make the only background be the background asset
User prompt
The background images needs to be an asset
User prompt
Make it so I can use a custom image for the background.
User prompt
Make sure the game only ends when the current timer hits 0
User prompt
Make it so getting 1 ball adds 1 second to the timer.
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,22 @@
/****
* Classes
****/
+// Splash effect class
+var Splash = Container.expand(function () {
+ var self = Container.call(this);
+ var splashGraphics = self.createAsset('splash', 'Splash effect', 0.5, 0.5);
+ self.lifeSpan = 30; // Frames until splash fades out
+ self.update = function () {
+ self.alpha -= 1 / self.lifeSpan;
+ if (self.alpha <= 0) {
+ self.isDestroyed = true;
+ self.destroy();
+ } // Destroy splash when faded out
+ };
+ LK.on('tick', self.update);
+});
+// Function to create a splash effect
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.createAsset('particle', 'Ball trail particle', 0.5, 0.5);
self.lifeSpan = 60; // Frames until particle fades out
@@ -56,8 +71,9 @@
LK.setScore(LK.getScore() + ball.scoreValue);
timerSeconds += 1; // Add 1 second to the timer
updateScoreDisplay();
timerTxt.setText(timerSeconds.toString()); // Update the timer display
+ LK.effects.flashObject(ball, 0xffff00, 300); // Add a yellow glow effect to the ball for 300ms when caught
return true;
}
return false;
};
@@ -72,9 +88,16 @@
/****
* Game Code
****/
+// Function to create a splash effect
// Create and set the new background
+function createSplash(x, y) {
+ var splash = new Splash();
+ splash.x = x;
+ splash.y = y;
+ game.addChild(splash);
+}
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);
@@ -120,8 +143,9 @@
for (var i = balls.length - 1; i >= 0; i--) {
if (cup.intersects(balls[i])) {
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();
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.