Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: self.addBiteMark is not a function' in this line: 'self.addBiteMark();' Line Number: 107
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'push')' in this line: 'bowls.push(bowl);' Line Number: 104
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 172
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 172
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 172
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 174
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 173
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(butter);' Line Number: 183
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 188
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 173
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(eggs[eggs.length - 1]);' Line Number: 173
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 173
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'for (var i = 0; i < 8; i++) {}' Line Number: 175
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'LK.on('tick', function () {});' Line Number: 176
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'Game.prototype.startGame = function () {};' Line Number: 177
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'stage.on('move', function (obj) {});' Line Number: 178
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'stage.on('up', function (obj) {});' Line Number: 179
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.x = newX;' Line Number: 89
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 174
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(eggs[eggs.length - 1]);' Line Number: 174
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'self.addChild(egg);' Line Number: 174
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in this line: 'for (var i = 0; i < 8; i++) {}' Line Number: 176
var Bowl = Container.expand(function () { var self = Container.call(this); var bowlGraphics = self.createAsset('bowl', 'Bowl Graphics', 0, 1); self.x = 0; self.y = 2732 - bowlGraphics.height; self.height = bowlGraphics.height; self.containsPoint = function (point) { return point.x >= this.x && point.x <= this.x + this.width && point.y >= this.y - 300 && point.y <= this.y + this.height; }; self.hasEgg = false; self.hasSugar = false; self.hasButter = false; }); var Egg = Container.expand(function () { var self = Container.call(this); var eggGraphics = self.createAsset('egg', 'Egg Graphics', .5, .5); self.containsPoint = function (point) { return point.x >= this.x - this.width / 2 && point.x <= this.x + this.width / 2 && point.y >= this.y - this.height / 2 && point.y <= this.y + this.height / 2; }; self.crack = function () { var crackedEggGraphics = self.createAsset('cracked_egg', 'Cracked Egg Graphics', .5, .5); self.removeChild(eggGraphics); self.addChild(crackedEggGraphics); }; }); var Sugar = Container.expand(function () { var self = Container.call(this); var sugarGraphics = self.createAsset('sugar', 'Sugar Graphics', .5, .5); self.containsPoint = function (point) { return point.x >= this.x - this.width / 2 && point.x <= this.x + this.width / 2 && point.y >= this.y - this.height / 2 && point.y <= this.y + this.height / 2; }; self.pour = function (bowl) { var pouredSugarGraphics = self.createAsset('poured_sugar', 'Poured Sugar Graphics', .5, .5); self.removeChild(sugarGraphics); self.addChild(pouredSugarGraphics); }; }); var Butter = Container.expand(function () { var self = Container.call(this); var butterGraphics = self.createAsset('butter', 'Butter Graphics', .5, .5); self.containsPoint = function (point) { return point.x >= this.x - this.width / 2 && point.x <= this.x + this.width / 2 && point.y >= this.y - this.height / 2 && point.y <= this.y + this.height / 2; }; self.unpack = function (bowl) { var unpackedButterGraphics = self.createAsset('unpacked_butter', 'Unpacked Butter Graphics', .5, .5); self.removeChild(butterGraphics); self.addChild(unpackedButterGraphics); }; }); var Cookie = Container.expand(function () { var self = Container.call(this); var cookieGraphics = self.createAsset('cookie', 'Cookie Graphics', .5, .5); self.bake = function () {}; self.addBiteMark = function () { var biteMarkGraphics = self.createAsset('bitemark', 'Bite Mark Graphics', .5, .5); biteMarkGraphics.x = cookieGraphics.x; biteMarkGraphics.y = cookieGraphics.y; self.addChild(biteMarkGraphics); }; self.flyToRandomPosition = function () { var randomX = Math.random() * 2048; var randomY = Math.random() * (2732 / 2); self.elasticTween = function (start, end, duration, callback) { var delta = end - start; var startTime = LK.ticks; function easeInOutElastic(t, b, c, d) { t /= d / 2; if (t < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; t--; return c / 2 * (-Math.pow(2, -10 * t) + 2) + b; } LK.on('tick', function () { var currentTime = LK.ticks - startTime; if (currentTime < duration) { var newPos = easeInOutElastic(currentTime, start, delta, duration); callback(newPos); } else { callback(end); LK.off('tick', this); } }); }; self.elasticTween(self.y, randomY, 120, function (newY) { self.y = newY; }); self.elasticTween(self.x, randomX, 120, function (newX) { self.x = newX; }); }; }); var Game = Container.expand(function () { var self = Container.call(this); stage.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); bowls.forEach(function (bowl, index) { if (bowl.containsPoint(pos) && bowl.hasEgg && bowl.hasSugar && bowl.hasButter) { for (var j = 0; j < 10; j++) { var cookie = new Cookie(); cookie.bake(); cookie.x = bowl.x + bowl.width / 2; cookie.y = bowl.y - cookie.height / 2; cookie.roation = Math.random() * (Math.PI * 2); self.addChild(cookie); cookies.push(cookie); cookie.flyToRandomPosition(); cookie.on('down', function () { this.addBiteMark(); }); } bowls[index].destroy(); bowls.splice(index, 1); sugars[index].destroy(); sugars.splice(index, 1); butters[index].destroy(); butters.splice(index, 1); eggs[index].destroy(); eggs.splice(index, 1); } }); eggs.forEach(function (egg, index) { if (egg.containsPoint(pos)) { egg.crack(); var targetBowl = bowls[index % bowls.length]; egg.x = targetBowl.x + targetBowl.width / 2 + 60; egg.y = targetBowl.y - egg.height - 50; targetBowl.hasEgg = true; } }); butters.forEach(function (butter, index) { if (butter.containsPoint(pos)) { var targetBowl = bowls[index % bowls.length]; butter.unpack(targetBowl); butter.x = targetBowl.x + targetBowl.width / 2 - 60; butter.y = targetBowl.y - butter.height - 50; targetBowl.hasButter = true; } }); sugars.forEach(function (sugar, index) { if (sugar.containsPoint(pos)) { var targetBowl = bowls[index % bowls.length]; sugar.pour(); sugar.x = targetBowl.x + targetBowl.width / 2; sugar.y = targetBowl.y - sugar.height; targetBowl.hasSugar = true; } }); }); var bowls = []; var sugars = []; var eggs = []; var butters = []; var cookies = []; for (var i = 0; i < 8; i++) { var bowl = new Bowl(); var sugar = new Sugar(); var butter = new Butter(); var egg = new Egg(); bowl.x = i * (bowl.width + 10); sugar.x = 200 + Math.random() * 1600; sugar.y = 200 + Math.random() * 2032; butter.x = 200 + Math.random() * 1600; butter.y = 200 + Math.random() * 2032; egg.x = 200 + Math.random() * 1600; egg.y = 200 + Math.random() * 2032; bowls.push(bowl); sugars.push(sugar); butters.push(butter); eggs.push(egg); self.addChild(bowl); self.addChild(sugar); self.addChild(butter); self.addChild(egg); } });
===================================================================
--- original.js
+++ change.js
@@ -54,9 +54,8 @@
self.addBiteMark = function () {
var biteMarkGraphics = self.createAsset('bitemark', 'Bite Mark Graphics', .5, .5);
biteMarkGraphics.x = cookieGraphics.x;
biteMarkGraphics.y = cookieGraphics.y;
- biteMarkGraphics.blendMode = BLEND_MODES.ERASE;
self.addChild(biteMarkGraphics);
};
self.flyToRandomPosition = function () {
var randomX = Math.random() * 2048;
egg. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
sugar in a bag. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a butter stik in its wrapper. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a pink kithen bowl. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pile of sugar. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cracked egg white and yolk seeping. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
soft butter stick. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A delicious plain vanilla cookie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A delicious plain vanilla cookie, where three bites have been taken. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A cute kawaian bakery interior with strawberry tiles. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A cute girl happily eating way too many vanilla cookies. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.