User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'moneyArray[a].move();' Line Number: 27
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'moneyArray[a].move();' Line Number: 27
Initial prompt
Money Clicker
===================================================================
--- original.js
+++ change.js
@@ -40,9 +40,9 @@
});
stage.on('down', function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
- for (var a = moneyArray.length; a >= 0; a--) {
+ for (var a = moneyArray.length - 1; a >= 0; a--) {
if (moneyArray[a].intersects(pos)) {
moneyArray[a].destroy();
moneyArray.splice(a, 1);
score++;