User prompt
Please fix the bug: 'Timeout.tick error: game.clear is not a function' in or related to this line: 'game.clear(); // Clear all objects from the game' Line Number: 141
User prompt
Please fix the bug: 'TypeError: balloons[i].update is not a function' in or related to this line: 'balloons[i].update();' Line Number: 100
User prompt
Please fix the bug: 'Balloon.extend is not a function' in or related to this line: 'var Balloon2 = Balloon.extend(function () {' Line Number: 60
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: LK.clear is not a function' in or related to this line: 'LK.clear(); // Clear all objects from the game' Line Number: 113
User prompt
Please fix the bug: 'Timeout.tick error: game.clear is not a function' in or related to this line: 'game.clear(); // Clear all objects from the game' Line Number: 113
User prompt
Please fix the bug: 'setInterval is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 121
User prompt
Please fix the bug: 'setInterval is not a function' in or related to this line: 'setInterval(function () {' Line Number: 103
Code edit (1 edits merged)
Please save this source code
Initial prompt
Balloon Hunter
===================================================================
--- original.js
+++ change.js
@@ -47,8 +47,18 @@
anchorY: 0.5
});
// Increase speed for Balloon2
self.speed += 1;
+ // Update function to move the balloon
+ self.update = function () {
+ self.y -= self.speed;
+ self.x += self.direction;
+ // If the balloon goes off screen, reset its position
+ if (self.y < -100) {
+ self.y = 2732 + 100;
+ self.x = Math.random() * 2048;
+ }
+ };
});
/****
* Initialize Game