Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: stars is not defined' in or related to this line: 'for (var i = stars.length - 1; i >= 0; i--) {' Line Number: 401
User prompt
add the stars to the stars array and update them from game tick function.
User prompt
the stars should explode upwards in all directions and then drop down while they fade out and disappear
User prompt
whenever score increases, create a particle explosion of stars around the scorelabel
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
in the handleButtons function, add a copy of the button clicked to the latest cakelayer added.
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: button.parent.numChildren is not a function' in or related to this line: 'console.log('button.parent.children.length - 1: ' + button.parent.numChildren() - 1);' Line Number: 358
Code edit (1 edits merged)
Please save this source code
User prompt
show a scorelabel center top
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Error: The supplied index is out of bounds' in or related to this line: 'button.parent.setChildIndex(button, button.parent.getChildIndex(latestCakeLayer) + 1);' Line Number: 356
User prompt
in handlebuttons, also move the pressed button to a layer above the latest cake layer.
Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: game.getChildren is not a function' in or related to this line: 'button.zIndex = game.getChildren().length;' Line Number: 350
Code edit (1 edits merged)
Please save this source code
User prompt
let all buttons call handlebuttons function in their on down handler.
User prompt
implement the handebuttons function according to the comments inside it.
Code edit (1 edits merged)
Please save this source code
Initial prompt
Copy Layer Cake Panic
===================================================================
--- original.js
+++ change.js
@@ -338,10 +338,10 @@
if (cakeLayers.length > 0) {
var latestCakeLayer = cakeLayers[cakeLayers.length - 1];
var buttonCopy = new button.constructor();
buttonCopy.interactive = false;
- buttonCopy.x = latestCakeLayer.x + button.x - 500;
- buttonCopy.y = latestCakeLayer.y;
+ buttonCopy.x = latestCakeLayer.x + button.x - 1000;
+ buttonCopy.y = latestCakeLayer.y - 150;
game.addChild(buttonCopy);
}
}
;
@@ -355,9 +355,33 @@
scoreLabel.anchor.set(0.5, 0);
game.addChild(scoreLabel);
// Game tick event
LK.on('tick', function () {
- scoreLabel.setText('' + score);
+ if (score != LK.getScore()) {
+ score = LK.getScore();
+ scoreLabel.setText('' + score);
+ // Create a particle explosion of stars around the scorelabel
+ for (var i = 0; i < 10; i++) {
+ var star = LK.getAsset('star', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: scoreLabel.x + Math.random() * 200 - 100,
+ y: scoreLabel.y + Math.random() * 200 - 100
+ });
+ game.addChild(star);
+ star.vx = Math.random() * 2 - 1;
+ star.vy = Math.random() * 2 - 1;
+ star.life = 60;
+ star.on('tick', function () {
+ star.x += star.vx;
+ star.y += star.vy;
+ star.life--;
+ if (star.life <= 0) {
+ star.destroy();
+ }
+ });
+ }
+ }
// Move cake layers
for (var i = cakeLayers.length - 1; i >= 0; i--) {
cakeLayers[i].move();
// Remove off-screen cake layers
a dark wooden kitchen table with a serving plate.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bakery wall with shelves full of cakes, toppings, berries. Rich game illustration style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A swirl of delicious whipped cream. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A small pile of delicious blueberries. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A few delicious red raspberries, cleaned.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Lush, mature strawberries, cleaned and slices and ready for use in bakery or for decoration.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A little green frog. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A cute little goldfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A golden star.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A pile of pieces of milk chocolate. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.