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.
/**** * Classes ****/ // Ball class var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.createAsset('ball', 'Falling ball', 0.5, 0.5); self.speed = Math.random() * 3 + 2; // Balls will have speeds between 2 and 5 self.scoreValue = 1; // Default score value for each ball self.move = function () { self.y += self.speed; }; self.resetPosition = function () { self.x = Math.random() * (2048 - ballGraphics.width) + ballGraphics.width / 2; self.y = -ballGraphics.height; }; self.resetPosition(); }); // Cup class var Cup = Container.expand(function () { var self = Container.call(this); var cupGraphics = self.createAsset('cup', 'Cup to catch balls', 0.5, 1); 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 += 1; // Add 1 second to the timer updateScoreDisplay(); timerTxt.setText(timerSeconds.toString()); // Update the timer display return true; } return false; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize game elements var balls = []; var cup = game.addChild(new Cup()); 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; // Create a function to update the score display function updateScoreDisplay() { scoreTxt.setText(score.toString()); } // Create a function to add a new ball function addBall() { var ball = new Ball(); balls.push(ball); game.addChild(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])) { score += balls[i].scoreValue; updateScoreDisplay(); 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) { handleDrag(obj); }); game.on('move', function (obj) { handleDrag(obj); }); // Main game loop // Removed the gameTimer as the game over logic will be handled in the tick function var timerSeconds = 60; LK.on('tick', function () { // Move balls for (var i = 0; i < balls.length; i++) { balls[i].move(); } // Update timer display and check for game over if (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(); // Add new balls if (LK.ticks % 60 == 0) { // Every second addBall(); } });
===================================================================
--- original.js
+++ change.js
@@ -39,11 +39,9 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000,
- //Init game with black background
- backgroundImage: 'background' // Set the 'background' asset as the game's background
+ backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
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.