Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: shape.update is not a function' in this line: 'shape.update();' Line Number: 240
User prompt
Fix Bug: 'TypeError: shape.update is not a function' in this line: 'shape.update();' Line Number: 259
User prompt
Fix Bug: 'TypeError: shape.update is not a function' in this line: 'shape.update();' Line Number: 278
User prompt
Fix Bug: 'TypeError: shape.update is not a function' in this line: 'shape.update();' Line Number: 278
Code edit (9 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: staticShape is not defined' in this line: 'staticShape.x = pos.x - staticShape.width / 2;' Line Number: 216
User prompt
Fix Bug: 'TypeError: self.staticShape.update is not a function' in this line: 'if (self.staticShape) self.staticShape.update();' Line Number: 229
User prompt
Fix Bug: 'TypeError: Cannot read properties of null (reading 'update')' in this line: 'staticShape.update();' Line Number: 229
User prompt
Fix Bug: 'ReferenceError: staticShape is not defined' in this line: 'staticShape.update();' Line Number: 228
User prompt
Fix Bug: 'ReferenceError: staticShape is not defined' in this line: 'staticShape.update();' Line Number: 228
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading '0')' in this line: 'levelText.setText('Level ' + (currentLevel + 1) + ' - Explode ' + levels[currentLevel][0] + ' of ' + levels[currentLevel][1] + ' shapes');' Line Number: 207
Code edit (7 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading '1')' in this line: 'for (var i = 0; i < levels[currentLevel][1]; i++) {' Line Number: 198
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'undefined')' in this line: 'levelText.setText('Level 1 - Explode ' + self.levels[self.currentLevel][0] + ' of ' + self.levels[self.currentLevel][0] + ' shapes');' Line Number: 204
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'undefined')' in this line: 'if (collisionsCount > self.levels[self.currentLevel][0]) {' Line Number: 188
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'expandedCount')' in this line: 'self.parent.expandedCount--;' Line Number: 136
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'expandedCount')' in this line: 'self.parent.expandedCount--;' Line Number: 136
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: expandedCount is not defined' in this line: 'expandedCount++;' Line Number: 205
Code edit (2 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -92,8 +92,27 @@
var scaleDown2 = function () {
self.scalingDown = true;
};
LK.setTimeout(scaleUp2, 1);
+ var update = function () {
+ if (self.scalingUp) {
+ if (self.scale.x < 4) {
+ self.scale.x += 0.04;
+ self.scale.y += 0.04;
+ } else {
+ self.scalingUp = false;
+ LK.setTimeout(scaleDown2, 5000);
+ }
+ } else if (self.scalingDown) {
+ if (self.scale.x > 0.4) {
+ self.scale.x -= 0.4;
+ self.scale.y -= 0.4;
+ } else {
+ if (self.parent) self.parent.expandedCount--;
+ self.destroy();
+ }
+ }
+ };
});
var Shape = Container.expand(function () {
console.log('Shape created');
var self = Container.call(this);
@@ -160,8 +179,27 @@
};
var scaleDown2 = function () {
self.scalingDown = true;
};
+ self.update = function () {
+ if (self.scalingUp) {
+ if (self.scale.x < 4) {
+ self.scale.x += 0.04;
+ self.scale.y += 0.04;
+ } else {
+ self.scalingUp = false;
+ LK.setTimeout(scaleDown2, 5000);
+ }
+ } else if (self.scalingDown) {
+ if (self.scale.x > 0.4) {
+ self.scale.x -= 0.4;
+ self.scale.y -= 0.4;
+ } else {
+ if (self.parent) self.parent.expandedCount--;
+ self.destroy();
+ }
+ }
+ };
});
var Game = Container.expand(function () {
var self = Container.call(this);
self.expandedCount = 1;
@@ -233,11 +271,12 @@
self.expandedCount = 1;
levelText.setText('Level ' + (currentLevel + 1) + ' - Get ' + levels[currentLevel][0] + ' out of ' + levels[currentLevel][1] + ' shapes');
return;
}
- if (self.staticShape && typeof self.staticShape.update === 'function') self.staticShape.update();
+ if (self.staticShape && self.staticShape.update) self.staticShape.update();
shapes.forEach(function (shape) {
shape.move();
+ if (shape.update) shape.update();
self.children.forEach(function (child) {
if (shape !== child && !shape.isCollided && child.isCollided && circlesCollide(shape, child)) {
shape.explode();
collisionsCount++;
a white geometric square shape Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a white dot Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
flat white round disk Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
gif circle spinning animation Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.