User prompt
Add a 4px margin to bubbels
User prompt
Spawn bubbels when game start
User prompt
Use a 2D array for bubbels
User prompt
Create a 9x9 grid of bubbles
User prompt
Remove the code that spawns bubbles in tick
User prompt
Remove the hero class
User prompt
Remove the enemy class
User prompt
Fix Bug: 'TypeError: hero.update is not a function. (In 'hero.update()', 'hero.update' is undefined)' in this line: 'hero.update();' Line Number: 36
Initial prompt
Click remove
var Bubble = Container.expand(function () {
var self = Container.call(this);
var bubbleGraphics = self.createAsset('bubble', 'Bubble Graphics', .5, .5);
self.move = function () {};
self.pop = function () {};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var bubbles = new Array(9).fill().map(() => new Array(9).fill(null));
var spawnBubble = function () {
for (var i = 0; i < 9; i++) {
for (var j = 0; j < 9; j++) {
var newBubble = new Bubble();
newBubble.x = i * newBubble.width;
newBubble.y = j * newBubble.height;
bubbles[i][j] = newBubble;
self.addChild(newBubble);
}
}
};
spawnBubble();
LK.on('tick', function () {
for (var i = 0; i < bubbles.length; i++) {
for (var j = 0; j < bubbles[i].length; j++) {
if (bubbles[i][j]) {
bubbles[i][j].move();
}
}
}
});
});
===================================================================
--- original.js
+++ change.js
@@ -17,8 +17,9 @@
self.addChild(newBubble);
}
}
};
+ spawnBubble();
LK.on('tick', function () {
for (var i = 0; i < bubbles.length; i++) {
for (var j = 0; j < bubbles[i].length; j++) {
if (bubbles[i][j]) {