Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (23 edits merged)
Please save this source code
User prompt
implement //Loop over rows, if a row only has empty values in it, remove it.
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'game.addChildAt(currentBubble, particleInjectionZIndex);' Line Number: 555
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'currentBubble = hintBubbles[hintBubbleOffset] = new HintBubble();' Line Number: 554
Code edit (10 edits merged)
Please save this source code
User prompt
implement self.printRowsToConsole = function () { //Prints nice representation of the rows grid to console as a string };
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (14 edits merged)
Please save this source code
User prompt
We have the pixel offsets for the bubbles around offsetPositions, however we also want to offset in terms of offset in the rows / columns grid. Can you add that as rx: and ry:
User prompt
Add row / column offsets to offsetPositions
User prompt
implement //Loop trough the offsetPositions and find the one that bubble is closest to
Code edit (4 edits merged)
Please save this source code
User prompt
implement //Calculate the position of potential neighbour bubbles into a list here
Code edit (1 edits merged)
Please save this source code
User prompt
implement /* Based on the intersectedBubble x,y position calculate the 6 points around this bubble where another bubble could exist and put that into a list. */
Code edit (1 edits merged)
Please save this source code
User prompt
implement //Based on intersectedBubblePos calculate the absolute row and column numbers to insert the current moving bubble to attach it to the grid
Code edit (3 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -280,14 +280,16 @@
angle: angle
});
};
self.update = function () {
- for (var rep = 0; rep < 15; rep++) {
- for (var a = 0; a < bubblesInFlight.length; a++) {
- var current = bubblesInFlight[a];
- var bubble = current.bubble;
- var nextX = bubble.x + Math.cos(current.angle) * 4;
- var nextY = bubble.y + Math.sin(current.angle) * 4;
+ outer: for (var a = 0; a < bubblesInFlight.length; a++) {
+ var current = bubblesInFlight[a];
+ var bubble = current.bubble;
+ var nextX = bubble.x;
+ var nextY = bubble.y;
+ for (var rep = 0; rep < 25; rep++) {
+ nextX += Math.cos(current.angle) * 4;
+ nextY += Math.sin(current.angle) * 4;
if (nextX < 150 / 2 || nextX > 2048 - 150 / 2) {
current.angle = Math.PI - current.angle; // Reflect angle
nextX = Math.min(Math.max(nextX, 150 / 2), 2048 - 150 / 2);
}
@@ -366,9 +368,9 @@
row = [null, null, null, null, null, null, null, null, null, null, null, null, null];
}
rows.unshift(row);
}
- console.log(offsetPositions[closestPosition].co);
+ //console.log(offsetPositions[closestPosition].co);
row[offsetPositions[closestPosition].co] = bubble;
bubblesInFlight.splice(a--, 1);
refreshHintLine();
var bubbles = self.getConnectedBubbles(bubble);
@@ -383,27 +385,39 @@
})) {
rows.splice(row, 1);
}
}
- self.printRowsToConsole();
- } else {
- bubble.x = nextX;
- bubble.y = nextY;
+ //self.printRowsToConsole();
+ continue outer;
}
}
+ bubble.x = nextX;
+ bubble.y = nextY;
+ if (bubble.y + self.y < -1000) {
+ //Destory bubbles that somehow manages to escape at the top
+ bubblesInFlight.splice(a--, 1);
+ bubble.destroy();
+ }
}
+ self.y += .5;
+ var zeroRow = rows[0];
+ if (zeroRow) {
+ for (var a = 0; a < zeroRow.length; a++) {
+ var bubble = zeroRow[a];
+ if (bubble) {
+ if (bubble.y + self.y > 2000) {
+ insertRow();
+ }
+ break;
+ }
+ }
+ } else {
+ insertRow();
+ }
};
- insertRow();
- insertRow();
- insertRow();
- insertRow();
- insertRow();
- insertRow();
- insertRow();
- insertRow();
- insertRow();
- insertRow();
- insertRow();
+ for (var a = 0; a < 5; a++) {
+ insertRow();
+ }
});
var HintBubble = Container.expand(function () {
var self = Container.call(this);
var bubble = self.attachAsset('hintbubble', {
@@ -542,10 +556,10 @@
isValid = angle < -.2 && angle > -Math.PI + .2;
if (isValid) {
path = grid.calculatePath(launcher, angle);
//This allows updated faster than 60fps, making everyting feel better.
- renderHintBubbels();
}
+ renderHintBubbels();
}
var hintOffset = 0;
var distanceBetweenHintbubbles = 100;
function renderHintBubbels() {
@@ -594,9 +608,9 @@
bubbleAlpha = Math.min(bubbleAlpha + .05, 1);
} else {
bubbleAlpha = Math.max(bubbleAlpha - .05, 0);
}
- renderHintBubbels();
+ refreshHintLine();
};
game.up = function () {
if (isValid) {
launcher.fire();
Circular white gradient circle on black background. Gradient from white on the center to black on the outer edge all around.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Soft straight Long red paint on black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fire ball. Bubble shooter game. Thin black outline.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
green notification bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.