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
@@ -7,9 +7,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Strawberry button was pressed');
+ handleButtons(self);
});
});
var RaspberryButton = Container.expand(function () {
var self = Container.call(this);
@@ -17,9 +17,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Raspberry button was pressed');
+ handleButtons(self);
});
});
var WhippedCreamButton = Container.expand(function () {
var self = Container.call(this);
@@ -27,9 +27,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Whipped cream button was pressed');
+ handleButtons(self);
});
});
var MangoButton = Container.expand(function () {
var self = Container.call(this);
@@ -37,9 +37,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Mango button was pressed');
+ handleButtons(self);
});
});
var MouseButton = Container.expand(function () {
var self = Container.call(this);
@@ -47,9 +47,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Mouse button was pressed');
+ handleButtons(self);
});
});
var FishButton = Container.expand(function () {
var self = Container.call(this);
@@ -57,9 +57,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Fish button was pressed');
+ handleButtons(self);
});
});
// CakeLayer class
var CakeLayer = Container.expand(function () {
@@ -128,9 +128,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Blueberry button was pressed');
+ handleButtons(self);
});
});
var NutellaButton = Container.expand(function () {
var self = Container.call(this);
@@ -138,9 +138,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Nutella button was pressed');
+ handleButtons(self);
});
});
var PineappleButton = Container.expand(function () {
var self = Container.call(this);
@@ -148,9 +148,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Pineapple button was pressed');
+ handleButtons(self);
});
});
var FrogButton = Container.expand(function () {
var self = Container.call(this);
@@ -158,9 +158,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function (obj) {
- console.log('Frog button was pressed');
+ handleButtons(self);
});
});
/****
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.