User prompt
in getDetachedBubbles you are using getConnectedBubbles however that is type dependent, for this case any type should count as connected.
Code edit (5 edits merged)
Please save this source code
User prompt
rewrite getDetachedBubbles such that it counts from the last element in rows not the first
Code edit (18 edits merged)
Please save this source code
Code edit (25 edits merged)
Please save this source code
Code edit (25 edits merged)
Please save this source code
Code edit (17 edits merged)
Please save this source code
User prompt
in bubble update, if not attached, if a bubble intersects with a barrier and the bubble is moving towards the barrier. Bounce the bubble off the barrier
Code edit (3 edits merged)
Please save this source code
User prompt
in bible update, update the intersection logic to assume the barriers is a rectangle and the balls is a circle
User prompt
the modification of speedX and speedY should be based on rectangle to circle intersection and the out angle after intersection should be calculated accordingly
User prompt
In ball update, update the intersection logic such that it's between the ball circle and the barrier rectangle. With all the faces of the rectangle being factored in.
Code edit (1 edits merged)
Please save this source code
User prompt
n ball update, update the intersection logic such that it's between the ball circle and the barrier rectangle. With all the faces of the rectangle being factored in. Please factor in that both barrier and balls have an anchor point of .5, .5
User prompt
in bubble update, if not attached, if a bubble intersects with a barrier and the bubble is moving towards the barrier. Bounce the bubble off the barrier. Consider the barriers 4 lines each that is intersected with individually. With the circles new speedX and speedY being calculated based on circle to line intersections using real physics.
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self.intersectsLine is not a function. (In 'self.intersectsLine(line.x1, line.y1, line.x2, line.y2)', 'self.intersectsLine' is undefined)' in or related to this line: 'if (self.intersectsLine(line.x1, line.y1, line.x2, line.y2) && movingTowards) {' Line Number: 85
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: checkLineIntersection' in or related to this line: 'if (checkLineIntersection(self.x, self.y, self.x + speedX, self.y + speedY, line.x1, line.y1, line.x2, line.y2) && movingTowards) {' Line Number: 85
Code edit (1 edits merged)
Please save this source code
User prompt
Bubbles should intersect barriers, and bounce based on circle to line intersection. With each barrier being considered four lines. The balls should bounce of the barriers similar to how the logic would be implemented in billiard or eight ball pool.
Code edit (6 edits merged)
Please save this source code
User prompt
Bubbles should intersect barriers, and bounce based on circle to line intersection. With each barrier being considered four lines and each bubble being a circle. The balls should bounce of the barriers similar to how the logic would be implemented in billiard or eight ball pool. Please consider that both bubbles and barriers have their anchor set at .5,.5
User prompt
Bubbles should intersect barriers, and bounce based on circle to line intersection. With each barrier being considered four lines and each bubble being a circle. The balls should bounce of the barriers similar to how the logic would be implemented in billiard or eight ball pool. Please consider that both bubbles and barriers have their anchor set at .5,.5
Code edit (10 edits merged)
Please save this source code
Code edit (25 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -7,40 +7,47 @@
var bubbleGraphics = self.attachAsset('bubble', {
anchorX: 0.5,
anchorY: 0.5
});
+ var state = 0;
var targetX = 0;
var targetY = 0;
+ var isAttached = true;
self.setPos = function (x, y) {
self.x = targetX = x;
self.y = targetY = y;
};
max_types = max_types || 3;
self.type = Math.floor(Math.random() * max_types);
bubbleGraphics.tint = colors[self.type];
+ self.detatch = function () {
+ //self.y += grid.y;
+ console.log(self.y);
+ game.addChild(self);
+ };
});
var Grid = Container.expand(function () {
var self = Container.call(this);
var rows = [];
- var container = self.addChild(new Container());
+ self.container = self.addChild(new Container());
var rowCount = 0;
function insertRow() {
var row = [];
var rowWidth = rowCount % 2 == 0 ? 13 : 12;
for (var a = 0; a < rowWidth; a++) {
var bubble = new Bubble();
bubble.setPos((2048 - bubble.width * rowWidth) / 2 + bubble.width * a + bubble.width / 2, -rowCount * (1.7320508076 * bubble.height) / 2);
- container.addChild(bubble);
+ self.container.addChild(bubble);
row.push(bubble);
bubble.down = function () {
var bubbles = self.getConnectedBubbles(this);
bubbles.forEach(function (b) {
- b.destroy();
+ b.detatch();
});
self.removeBubbles(bubbles);
var disconnected = self.getDetachedBubbles();
disconnected.forEach(function (b) {
- b.alpha = .5;
+ b.detatch();
});
};
}
rows.push(row);
@@ -93,9 +100,9 @@
var visited = connectedToTop.filter(function (bubble) {
return bubble != null;
});
// Find all bubbles that are not visited and not connected to the top
- for (var row = 1; row < rows.length; row++) {
+ for (var row = 0; row < rows.length - 1; row++) {
for (var col = 0; col < rows[row].length; col++) {
var bubble = rows[row][col];
if (bubble !== null && visited.indexOf(bubble) == -1) {
detachedBubbles.push(bubble);
@@ -148,9 +155,8 @@
insertRow();
insertRow();
insertRow();
insertRow();
- container.y = 1500;
});
var HintBubble = Container.expand(function () {
var self = Container.call(this);
});
@@ -168,5 +174,6 @@
/****
* Game Code
****/
//Game size 2048x2732
-var grid = game.addChild(new Grid());
\ No newline at end of file
+var grid = game.addChild(new Grid());
+grid.y = 2000;
\ No newline at end of file
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.